-
Notifications
You must be signed in to change notification settings - Fork 37
hit_record
Content of this page: Built-in versions of the hit_record
struct
that store the result of one or more ray / object intersection tests.
Note that the current version of Visionaray is an early preview. At this stage, the framework, including the API, are likely to undergo frequent changes.
Routines like the customization point intersect() or functions that are derived from it return an instance of struct
hit_record
storing information that is associated with the ray / object intersection. The information returned from a ray / object intersection typically varies among primitive types. Visionaray provides a few hit_record
implementations that may serve as a common base; the user is expected to return a custom hit_record
from his or her custon ray / object intersection test if the built-in hit_record
s provide insufficient data fields.
Derived built-in operations, such as the intersection of a ray and a bounding-volume hierarchy or the result from custom intersectors, return instances of the hit_record
struct
pertaining to the contained primitive. This is also true if the bounding-volume hierarchy contains custom primitives.
Visionaray provides built-in hit_record
struct
s for ray / triangle
and ray / sphere
intersections as well as for ray / axis-aligned bounding box
intersections.
The user can reuse the hit_record
struct
for ray / triangle
and ray / sphere
intersections by deriving from the base class template
visionaray::primitive
and by returning an instance of type hit_record<R, primitive>
from her custom intersect()
routine. In that case, the data fields prim_id
- a unique 32-bit signed integer primitive identifier, and geom_id
- a 32-bit signed integer geometry identifier that can e.g. be used by kernels as an index to material or texture lists, must be manually set.
In order to fulfill the hit_record
concept, a custom data type must provide the member typedef
scalar_type
.
hit_record - Ray, Triangle/Sphere
hit: mask_type // Was an object hit (true/false)?
prim_id: int_type // Id of the primitive (32-bit signed)
geom_id: int_type // Id of the parent geometry (32-bit signed)
t: scalar_type // Distance between ray origin and intersection position, FLT_MAX if no hit
u: scalar_type // Surface parameter
v: scalar_type // Surface parameter
hit_record - Ray, AABB
hit: mask_type // Was an object hit (true/false)?
tnear: scalar_type // Distance between ray origin and nearest intersection, FLT_MAX if no hit
tfar: scalar_type // Distance between ray origin and farthest intersection, FLT_MAX if no hit
-
scalar_type
holds a single decimal number ifRay
is a single ray, or is a SIMD floating-point type ifRay
is a ray packet. -
mask_type
is boolean ifRay
is a single ray, or a SIMD mask ifRay
is a ray packet. -
int_type
is a 32-bit signed integer ifRay
is a single ray, or a SIMD integer type ifRay
is a ray packet.
- Home
- Getting Started
- A Minimal Working Example
- Visionaray File Format (.vsnray)
- More Examples
- Troubleshooting
-
Developer Guide
- Scheduler and Kernel Concept
- Camera Concept
- Render Target Concept
- Built-in Schedulers, Kernels and Render Targets
- SIMD Math Library and Ray Packets
- Ray / Object Traversal
- Pixel sampling with primary rays
- Geometric Primitives
- Acceleration Data Structures and Traversal
- Surface Properties and Materials
- Texture Objects and Texture Intrinsics
-
Customization Points
- intersect()
- hit_record
- split_primitive()
- update_if() and is_closer()
- basic_intersector
- get_normal()
- get_tex_coord()
- References