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 instance ID (instID hit member) and geometry ID (geomID hit member)
34 of the hit data must be initialized 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 (instID hit member), geometry ID (geomID hit
44 member), and primitive ID (primID hit member). See Section [RTCHit]
45 for the hit layout description.
46
47 If the instance ID was set (thus it is not equal to RTC_INVALID_GEOME‐
48 TRY_ID), the instance ID corresponds to the geometry ID of the hit
49 instance of the top-level scene, the geometry ID corresponds to the hit
50 geometry inside the hit instanced scene, and the primitive ID corre‐
51 sponds to the n-th primitive of that geometry.
52
53 If the instance ID was not set (thus it is still equal to
54 RTC_INVALID_GEOMETRY_ID), the geometry ID corresponds to the hit geome‐
55 try inside the scene, and the primitive ID corresponds to the n-th
56 primitive 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
61 enlarged 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)