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

rtcIntersectNM & RTCRayHitN

Kloster__Marvin
Beginner
2,607 Views

Hi community,

i'm trying to intersect geometry with the rtcIntersectNM method. 

signature: void rtcIntersectNM( RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHitN* rayhit, unsigned int N, unsigned int M, size_t byteStride );

I don't unterstand how to create the RTCRayHitN*.

I've an array of RTCRayHit, a normal cast to (RTCRayHitN*) don't work.

Can anybody help me?

0 Kudos
1 Solution
BenthinC_Intel
Employee
2,607 Views

I would recommend to have look at the viewer_stream both for C++ and ISPC. Unfortunately we don't have an example which uses rtcIntersectNM with C++, only rtcIntersect1M. Probably the easiest way is to use ISPC to handle a stream of N-wide packets as in the viewer_stream_device.ispc example. BTW: In terms of performance the stream of packets makes only sense if you have a stream of extremely coherent rays. If you have less coherence in your stream I would recommend to use the standard packet interface.

View solution in original post

0 Kudos
6 Replies
BenthinC_Intel
Employee
2,607 Views

Do you trace just single rays (RTCRay + RTCHit)? If yes there's no need to use rtcIntersectNM. rtcIntersectNM is mostly useful for ray packets and/or stream of rays.

0 Kudos
Kloster__Marvin
Beginner
2,606 Views

Currently I trace snigle rays, but i want to trace packets. 

I don't understand how to use the RTCRayHitN struct.
I have an array of RTCRayHit[64]. From this array i want to create the RTCRayHitN data.

regards

Dekmor

0 Kudos
BenthinC_Intel
Employee
2,606 Views

OK, you have 64 single rays and want to trace them as packets. If you look in rtcore_ray.h we support explicit 4-wide, 8-wide, or 16-wide packets (RTCRayHit4, RTCRayHit8, RTCRayHit16), which means for your 64 single rays you get 16,8,or 4 ray packets. After initializing your packets, you can use rtcIntersect4/8/16 or rtcOccluded4/8/16 to trace them. A probably easier way to deal with packets is to use the ISPC compiler which uses Embree packet's interface per default.

0 Kudos
Kloster__Marvin
Beginner
2,606 Views

I would like to implement different types of tracing rays. One of these type is packet tracing with Streams. For that i need the rtcIntersectNM method. And there is the problem, how do I handle the type RTCRayHitN? 

Maybe later i will use the ISPC compiler.

 

0 Kudos
BenthinC_Intel
Employee
2,608 Views

I would recommend to have look at the viewer_stream both for C++ and ISPC. Unfortunately we don't have an example which uses rtcIntersectNM with C++, only rtcIntersect1M. Probably the easiest way is to use ISPC to handle a stream of N-wide packets as in the viewer_stream_device.ispc example. BTW: In terms of performance the stream of packets makes only sense if you have a stream of extremely coherent rays. If you have less coherence in your stream I would recommend to use the standard packet interface.

0 Kudos
Kloster__Marvin
Beginner
2,606 Views

Thanks for your help. That's what I wanted to hear. 

0 Kudos
Reply