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