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 ar‐
20 gument) 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 RTC_IN‐
48 VALID_GEOMETRY_ID, the instance ID on each level corresponds to the ge‐
49 ometry ID of the hit instance of the higher-level scene, the geometry
50 ID corresponds to the hit geometry inside the hit instanced scene, and
51 the primitive ID corresponds to the n-th primitive of that geometry.
52
53 If level 0 of the instance ID stack is equal to RTC_INVALID_GEOME‐
54 TRY_ID, the geometry ID corresponds to the hit geometry inside the
55 top-level scene, and the primitive ID corresponds to the n-th primitive
56 of that geometry.
57
58 The implementation makes no guarantees that primitives whose hit dis‐
59 tance is exactly at (or very close to) tnear or tfar are hit or missed.
60 If you want to exclude intersections at tnear just pass a slightly en‐
61 larged tnear, and if you want to include intersections at tfar pass a
62 slightly enlarged tfar.
63
64 The ray/hit structure must be aligned to 16 bytes.
65
66 EXIT STATUS
67 For performance reasons this function does not do any error checks,
68 thus will not set any error flags on failure.
69
70 SEE ALSO
71 [rtcOccluded1], [RTCRayHit], [RTCRay], [RTCHit]
72
73
74
75 rtcIntersect1(3)