1rtcInitIntersectContext(3)Embree Ray Tracing Kernels 3rtcInitIntersectContext(3)
2
3
4
5 NAME
6 rtcInitIntersectContext - initializes the intersection context
7
8 SYNOPSIS
9 #include <embree3/rtcore.h>
10
11 enum RTCIntersectContextFlags
12 {
13 RTC_INTERSECT_CONTEXT_FLAG_NONE,
14 RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT,
15 RTC_INTERSECT_CONTEXT_FLAG_COHERENT,
16 };
17
18 struct RTCIntersectContext
19 {
20 enum RTCIntersectContextFlags flags;
21 RTCFilterFunctionN filter;
22 unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
23 };
24
25 void rtcInitIntersectContext(
26 struct RTCIntersectContext* context
27 );
28
29 DESCRIPTION
30 A per ray-query intersection context (RTCIntersectContext type) is sup‐
31 ported that can be used to configure intersection flags (flags member),
32 specify a filter callback function (filter member), specify the ID of
33 the current instance (instID member), and to attach arbitrary data to
34 the query (e.g. per ray data).
35
36 The rtcInitIntersectContext function initializes the context to default
37 values and should be called to initialize every intersection context.
38 This function gets inlined, which minimizes overhead and allows for
39 compiler optimizations.
40
41 The intersection context flag can be used to tune the behavior of the
42 traversal algorithm. Using the RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT
43 flags uses an optimized traversal algorithm for incoherent rays
44 (default), while RTC_INTERSECT_CONTEXT_FLAG_COHERENT uses an optimized
45 traversal algorithm for coherent rays (e.g. primary camera rays).
46
47 Best primary ray performance can be obtained by using the ray stream
48 API and setting the intersect context flag to RTC_INTERSECT_CON‐
49 TEXT_FLAG_COHERENT. For secondary rays, it is typically better to use
50 the RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT flag, unless the rays are
51 known to be very coherent too (e.g. for primary transparency rays).
52
53 A filter function can be specified inside the context. This filter
54 function is invoked as a second filter stage after the per-geometry
55 intersect or occluded filter function is invoked. Only rays that
56 passed the first filter stage are valid in this second filter stage.
57 Having such a per ray-query filter function can be useful to implement
58 modifications of the behavior of the query, such as collecting all hits
59 or accumulating transparencies. The support for the context filter
60 function must be enabled for a scene by using the RTC_SCENE_FLAG_CON‐
61 TEXT_FILTER_FUNCTION scene flag.
62
63 It is guaranteed that the pointer to the intersection context passed to
64 a ray query is directly passed to the registered callback functions.
65 This way it is possible to attach arbitrary data to the end of the
66 intersection context, such as a per-ray payload.
67
68 Please note that the ray pointer is not guaranteed to be passed to the
69 callback functions, thus reading additional data from the ray pointer
70 passed to callbacks is not possible.
71
72 EXIT STATUS
73 No error code is set by this function.
74
75 SEE ALSO
76 [rtcIntersect1], [rtcOccluded1]
77
78
79
80 rtcInitIntersectContext(3)