Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Mos__Keicam
Beginner
286 Views

Transparent Objects - refraction

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
286 Views

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

Mos__Keicam
Beginner
286 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 ?

SvenW_Intel
Moderator
286 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.

Mos__Keicam
Beginner
286 Views

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

Mos__Keicam
Beginner
286 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.

SvenW_Intel
Moderator
286 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.

Mos__Keicam
Beginner
286 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)

BenthinC_Intel
Employee
286 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.

Mos__Keicam
Beginner
286 Views

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

Reply