![]() If (optix::dot(nf, theRay.direction) >= 0.0f) Also remove edge-on cases with the equal comparison. If the dot product is positive the ray points into the same hemisphere as the face normal, means it's hitting a backface. ![]() Calculate the triangle face normal in object space for counter clock winding triangle vertices.Ĭonst float3 nf = optix::normalize(optix::cross(v1 - v0, v2 - v0)) Mind that the rtCurrentRay is in object space inside the intersection program domain. 1.) Example how to early-exit the intersection program for backface hits. Then you do not even have a potential intersection which would reach the anyhit program which should be the faster face culling mechanism today. The faster method would be to change your intersection program to do something like this based on the code in ![]() Your example is the anyhit program on a shadow ray type only, but for face culling inside the anyhit program you would need some more code to handle the rtIgnoreIntersection when hitting the culled face. Then I would recommend you look through the OptiX Introduction examples (links below) and what you’re looking for is the rtIgnoreIntersection() function inside the anyhit functions for both the radiance and shadow ray types, used for texture based cutout opacity in example 07. Have a deeper look into chapter 4.8.2 when anyhit and closest hit programs are invoked: ![]() Please have a look into the OptiX documentation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |