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
23 #if RTC_MAX_INSTANCE_LEVEL_COUNT > 1
24 unsigned int instStackSize;
25 #endif
26
27 unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
28
29 #if RTC_MIN_WIDTH
30 float minWidthDistanceFactor;
31 #endif
32 };
33
34 void rtcInitIntersectContext(
35 struct RTCIntersectContext* context
36 );
37
38 DESCRIPTION
39 A per ray-query intersection context (RTCIntersectContext type) is sup‐
40 ported that can be used to configure intersection flags (flags member),
41 specify a filter callback function (filter member), specify the chain
42 of IDs of the current instance (instID and instStackSize members), and
43 to attach arbitrary data to the query (e.g. per ray data).
44
45 The rtcInitIntersectContext function initializes the context to default
46 values and should be called to initialize every intersection context.
47 This function gets inlined, which minimizes overhead and allows for
48 compiler optimizations.
49
50 The intersection context flag can be used to tune the behavior of the
51 traversal algorithm. Using the RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT
52 flags uses an optimized traversal algorithm for incoherent rays (de‐
53 fault), while RTC_INTERSECT_CONTEXT_FLAG_COHERENT uses an optimized
54 traversal algorithm for coherent rays (e.g. primary camera rays).
55
56 Best primary ray performance can be obtained by using the ray stream
57 API and setting the intersect context flag to RTC_INTERSECT_CON‐
58 TEXT_FLAG_COHERENT. For secondary rays, it is typically better to use
59 the RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT flag, unless the rays are
60 known to be very coherent too (e.g. for primary transparency rays).
61
62 A filter function can be specified inside the context. This filter
63 function is invoked as a second filter stage after the per-geometry in‐
64 tersect or occluded filter function is invoked. Only rays that passed
65 the first filter stage are valid in this second filter stage. Having
66 such a per ray-query filter function can be useful to implement modifi‐
67 cations of the behavior of the query, such as collecting all hits or
68 accumulating transparencies. The support for the context filter func‐
69 tion must be enabled for a scene by using the RTC_SCENE_FLAG_CON‐
70 TEXT_FILTER_FUNCTION scene flag. In case of instancing this feature
71 has to get enabled also for each instantiated scene.
72
73 The minWidthDistanceFactor value controls the target size of the curve
74 radii when the min-width feature is enabled. Please see the [rtcSetGe‐
75 ometryMaxRadiusScale] function for more details on the min-width fea‐
76 ture.
77
78 It is guaranteed that the pointer to the intersection context passed to
79 a ray query is directly passed to the registered callback functions.
80 This way it is possible to attach arbitrary data to the end of the in‐
81 tersection context, such as a per-ray payload.
82
83 Please note that the ray pointer is not guaranteed to be passed to the
84 callback functions, thus reading additional data from the ray pointer
85 passed to callbacks is not possible.
86
87 EXIT STATUS
88 No error code is set by this function.
89
90 SEE ALSO
91 [rtcIntersect1], [rtcOccluded1]
92
93
94
95 rtcInitIntersectContext(3)