Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPUs.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Ray packets performance

SergeyA
Novice
652 Views

Hi!

I'm using Embree for solving some collision-related tasks within my project. The average vertex count for the meshes within my working scene is ~5K. So, I'm determining the distance between 2 meshes along some direction by just iteratively calling rtcIntersect1() for rays segments with origin set to current vertex and the direction set to the mentioned above. All the rays are coherent as they use the direction.

Can I benefit from using the ray packet versions of rtcIntersect to get the total amount of queries N times less (N = 4,8,16) by just switching from the loop of single-ray queries to a N times shorter loop with packet queries? Or do I need some tricky ray packet setting with rays being set very close to each other within the single packet?

Also the minor question: can I safely use single ray intersection query for the same scene from several threads (each thread is supposed to run its own set of intersection queries from different origins in the same scene)?

Thank you in advance for answering.

0 Kudos
1 Solution
BenthinC_Intel
Employee
630 Views

Hi,

yes you can call rtcIntersect from multiple threads as there's NO synchronization mechanism within rtcIntersect. If you have multiple CPU cores in your system and each thread is running on a separate core you should observe a linear speedup, e.g. with 4 cores you should see 4 times reduction in run-time.

View solution in original post

3 Replies
BenthinC_Intel
Employee
644 Views

From your description it seems the rays inside the packet could have enough coherence so that ray packet traversal (rtcIntersect4/8/16) would provide a benefit. The rays inside the packet do not have to share a common origin. Just give it a try and simply use a N times shorter loop. Also you can safely use rtcIntersect from multiple threads at the same time.

SergeyA
Novice
635 Views

Hi BenthinC!

Could you please clarify on calling rtcIntersect from multiple threads, please?

Is there any data synchronization mechanism used within rtcIntersect (like, mutex)?

Say, I have M (~2-3k) single ray tracing queries. What exact benefit (measured in times) is expected from splitting this amount to N threads (each will execute the M/N queries) for N =10?

Thanks

BenthinC_Intel
Employee
631 Views

Hi,

yes you can call rtcIntersect from multiple threads as there's NO synchronization mechanism within rtcIntersect. If you have multiple CPU cores in your system and each thread is running on a separate core you should observe a linear speedup, e.g. with 4 cores you should see 4 times reduction in run-time.

Reply