1rtcIntersect1(3) Embree Ray Tracing Kernels 4 rtcIntersect1(3)
2
3
4
5 NAME
6 rtcIntersect1 - finds the closest hit for a single ray
7
8 SYNOPSIS
9 #include <embree4/rtcore.h>
10
11 void rtcIntersect1(
12 RTCScene scene,
13 struct RTCRayHit* rayhit
14 struct RTCIntersectArguments* args = NULL
15 );
16
17 DESCRIPTION
18 The rtcIntersect1 function finds the closest hit of a single ray (ray‐
19 hit argument) with the scene (scene argument). The provided ray/hit
20 structure contains the ray to intersect and some hit output fields that
21 are filled when a hit is found. The passed optional arguments struct
22 (args argument) can get used for advanced use cases, see section
23 [rtcInitIntersectArguments] for more details.
24
25 To trace a ray, the user has to initialize the ray origin (org ray mem‐
26 ber), ray direction (dir ray member), ray segment (tnear, tfar ray mem‐
27 bers), ray mask (mask ray member), and set the ray flags to 0 (flags
28 ray member). The ray time (time ray member) must be initialized to a
29 value in the range $[0, 1]. The ray segment has to be in the range
30 [0, ∞], thus ranges that start behind the ray origin are not valid, but
31 ranges can reach to infinity. See Section [RTCRay] for the ray layout
32 description.
33
34 The geometry ID (geomID hit member) of the hit data must be initialized
35 to RTC_INVALID_GEOMETRY_ID (-1).
36
37 When no intersection is found, the ray/hit data is not updated. When
38 an intersection is found, the hit distance is written into the tfar
39 member of the ray and all hit data is set, such as unnormalized geome‐
40 try normal in object space (Ng hit member), local hit coordinates (u, v
41 hit member), instance ID stack (instID hit member), geometry ID (geomID
42 hit member), and primitive ID (primID hit member). See Section
43 [RTCHit] for the hit layout description.
44
45 If the instance ID stack has a prefix of values not equal to RTC_IN‐
46 VALID_GEOMETRY_ID, the instance ID on each level corresponds to the ge‐
47 ometry ID of the hit instance of the higher-level scene, the geometry
48 ID corresponds to the hit geometry inside the hit instanced scene, and
49 the primitive ID corresponds to the n-th primitive of that geometry.
50
51 If level 0 of the instance ID stack is equal to RTC_INVALID_GEOME‐
52 TRY_ID, the geometry ID corresponds to the hit geometry inside the top-
53 level scene, and the primitive ID corresponds to the n-th primitive of
54 that geometry.
55
56 The implementation makes no guarantees that primitives whose hit dis‐
57 tance is exactly at (or very close to) tnear or tfar are hit or missed.
58 If you want to exclude intersections at tnear just pass a slightly en‐
59 larged tnear, and if you want to include intersections at tfar pass a
60 slightly enlarged tfar.
61
62 The ray/hit structure must be aligned to 16 bytes.
63
64 EXIT STATUS
65 For performance reasons this function does not do any error checks,
66 thus will not set any error flags on failure.
67
68 SEE ALSO
69 [rtcOccluded1], [rtcIntersect4/8/16], [RTCRayHit], [rtcInitIntersectAr‐
70 guments]
71
72
73
74 rtcIntersect1(3)