| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- .TH "rtcInitIntersectContext" "3" "" "" "Embree Ray Tracing Kernels 3"
- .SS NAME
- .IP
- .nf
- \f[C]
- rtcInitIntersectContext\ \-\ initializes\ the\ intersection\ context
- \f[]
- .fi
- .SS SYNOPSIS
- .IP
- .nf
- \f[C]
- #include\ <embree3/rtcore.h>
- enum\ RTCIntersectContextFlags
- {
- \ \ RTC_INTERSECT_CONTEXT_FLAG_NONE,
- \ \ RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT,
- \ \ RTC_INTERSECT_CONTEXT_FLAG_COHERENT,
- };
- struct\ RTCIntersectContext
- {
- \ \ enum\ RTCIntersectContextFlags\ flags;
- \ \ RTCFilterFunctionN\ filter;
- \ \ unsigned\ int\ instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
- };
- void\ rtcInitIntersectContext(
- \ \ struct\ RTCIntersectContext*\ context
- );
- \f[]
- .fi
- .SS DESCRIPTION
- .PP
- A per ray\-query intersection context (\f[C]RTCIntersectContext\f[]
- type) is supported that can be used to configure intersection flags
- (\f[C]flags\f[] member), specify a filter callback function
- (\f[C]filter\f[] member), specify the ID of the current instance
- (\f[C]instID\f[] member), and to attach arbitrary data to the query
- (e.g.
- per ray data).
- .PP
- The \f[C]rtcInitIntersectContext\f[] function initializes the context to
- default values and should be called to initialize every intersection
- context.
- This function gets inlined, which minimizes overhead and allows for
- compiler optimizations.
- .PP
- The intersection context flag can be used to tune the behavior of the
- traversal algorithm.
- Using the \f[C]RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT\f[] flags uses an
- optimized traversal algorithm for incoherent rays (default), while
- \f[C]RTC_INTERSECT_CONTEXT_FLAG_COHERENT\f[] uses an optimized traversal
- algorithm for coherent rays (e.g.
- primary camera rays).
- .PP
- Best primary ray performance can be obtained by using the ray stream API
- and setting the intersect context flag to
- \f[C]RTC_INTERSECT_CONTEXT_FLAG_COHERENT\f[].
- For secondary rays, it is typically better to use the
- \f[C]RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT\f[] flag, unless the rays are
- known to be very coherent too (e.g.
- for primary transparency rays).
- .PP
- A filter function can be specified inside the context.
- This filter function is invoked as a second filter stage after the
- per\-geometry intersect or occluded filter function is invoked.
- Only rays that passed the first filter stage are valid in this second
- filter stage.
- Having such a per ray\-query filter function can be useful to implement
- modifications of the behavior of the query, such as collecting all hits
- or accumulating transparencies.
- The support for the context filter function must be enabled for a scene
- by using the \f[C]RTC_SCENE_FLAG_CONTEXT_FILTER_FUNCTION\f[] scene flag.
- .PP
- It is guaranteed that the pointer to the intersection context passed to
- a ray query is directly passed to the registered callback functions.
- This way it is possible to attach arbitrary data to the end of the
- intersection context, such as a per\-ray payload.
- .PP
- Please note that the ray pointer is not guaranteed to be passed to the
- callback functions, thus reading additional data from the ray pointer
- passed to callbacks is not possible.
- .SS EXIT STATUS
- .PP
- No error code is set by this function.
- .SS SEE ALSO
- .PP
- [rtcIntersect1], [rtcOccluded1]
|