Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

Transparent Objects - refraction

Mos__Keicam
Beginner
1,449 Views

Hi,

I'm trying to implement refraction using embree but the problem is that transparency doesn't work. More precisely i added a cuboid and primary ray intersect the first face but the second passes through with hitting the other side.I tested with bias and it doesn't change anything. I have standard cube 8 vertices and 12 triangles and implementation is taken from triangle example in tutorials. Is it about turning on some flags ? I tried rtcSetSceneFlags(scene, RTC_SCENE_FLAG_ROBUST); but it doesn't change a thing . Help me pls!!

0 Kudos
9 Replies
SvenW_Intel
Moderator
1,449 Views

I do not understand where the problem lies. If the secondary hits the other side, then everything works as expected.

0 Kudos
Mos__Keicam
Beginner
1,449 Views

The problem is a typo;) instead "passes through with hitting" should be "passes through without hitting". It doesn't hit the second face of the cube. Some transparency flag is needed ?

0 Kudos
SvenW_Intel
Moderator
1,449 Views

Maybe you have backface culling enabled. This is a CMake option that is disabled by default. Otherwise, you likely calculate the transparency ray wrong.

0 Kudos
Mos__Keicam
Beginner
1,449 Views

I had it on. Still looking for a solution. Thanks anyway

0 Kudos
Mos__Keicam
Beginner
1,449 Views

Still haven't found it.

The thing is that transparent cube has duplicate vertices and when i cast rays from first face to the second face i dont have a hit. 

(each triangle of the cube has separete vertex + normal)

Are normals taken in account in calculation of intersection ? (Based on vertices orientation ) . I removed duplicates and it doesn't work - pls help im really stuck.

0 Kudos
SvenW_Intel
Moderator
1,449 Views

Could you please modify the triangle_geometry tutorial (which also has a cube) to illustrate the problem and then send us the code? We will then have a look what is going on here, but pretty sure you do not calculate the secondary ray properly.

0 Kudos
Mos__Keicam
Beginner
1,449 Views

Hi,

It's quite difficult to post the precise code as it's a part of much bigger project. After doing few tests it looks like it never hits second side of the object. Double sided test? I dont pass any normals and i havent seen any embree example with that. I geuss he computes normals from triangle. How can i get around it ? is the a swithc to treat all geometries as double sided? (Embree 3.2.0)

0 Kudos
BenthinC_Intel
Employee
1,449 Views

Did you compile Embree with enabled back-face culling (cmake option)? I think Sven's suggestion to modify our very simple triangle_geometry tutorial to illustrate the problem is the best path forward to debug this issue.

0 Kudos
Mos__Keicam
Beginner
1,449 Views

Thanks, I solved it. It was mistake on my part.

0 Kudos
Reply