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