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