RTCRay(3)
πΈ RTCRay(3) β Embree Ray Tracing Kernels 3 πΈ
okay bestie, gather round, because today we're learning about RTCRay, aka the single ray structure from the Embree Ray Tracing Kernels 3 manual. it's giving foundational. it's giving "everything else is built on me." let's go π
β¨ NAME β¨
RTCRay β the single ray structure, no cap π¦
β¨ SYNOPSIS β¨
#include <embree3/rtcore_ray.h>
struct RTC_ALIGN(16) RTCRay
{
float org_x; // x coordinate of ray origin
float org_y; // y coordinate of ray origin
float org_z; // y coordinate of ray origin
float tnear; // start of ray segment
float dir_x; // x coordinate of ray direction
float dir_y; // y coordinate of ray direction
float dir_z; // z coordinate of ray direction
float time; // time of this ray for motion blur
float tfar; // end of ray segment (set to hit distance)
unsigned int mask; // ray mask
unsigned int id; // ray ID
unsigned int flags; // ray flags
};
look at her. sixteen-byte aligned. immaculate. β¨
β¨ DESCRIPTION β¨
so RTCRay is literally the blueprint for one single ray. that's it. that's the whole job. and she does it flawlessly. π«Ά
inside her you get:
- the origin β that's the
org_x,org_y,org_zmembers - the direction vector β the
dir_x,dir_y,dir_zmembers - the ray segment β the
tnearandtfarmembers
and listen, the direction does not have to be normalized. not even a little. the only thing that matters is that the parameter range spelled out by the tnear/tfar interval is the valid bit. everything else is just vibes. π«
π¨ okay this part matters: the ray segment must be in the range [0, β]. so ranges that start behind the ray origin? not allowed, bestie. absolutely not. but the range can totally reach all the way out to infinity, because we're generous like that. π
and for rays inside a ray stream, the condition tfar < tnear is what identifies an inactive ray. that's the tell. that's the vibe check. π
she also carries a few extra lil accessories, because main character energy means coming prepared:
- a motion blur time in the range
[0, 1]β that's thetimemember β° - a ray mask β the
maskmember - a ray ID β the
idmember - ray flags β the
flagsmember
so about those:
- the ray mask can be used to mask out some geometries for some rays. (peep
rtcSetGeometryMaskif you want the whole story π) - the ray ID can be used to identify a ray inside a callback function β and yes, it still works even if the order of rays inside a ray packet or stream has changed. iconic, honestly. she keeps receipts. π
- the ray flags? reserved. don't touch. they're saving that seat. π
π¦ the plot twist: there's more in the header π¦
the embree3/rtcore_ray.h header is out here doing overtime, because it additionally defines the same ray structure in structure of array (SOA) layout for API functions that accept ray packets:
- size 4 β
RTCRay4type - size 8 β
RTCRay8type - size 16 β
RTCRay16type
and as if that wasn't enough, the header additionally defines an RTCRayNt template for ray packets of an arbitrary compile-time size. flexible queen. she said "any size you want, I'll be there." π
β¨ EXIT STATUS β¨
(nothing here, bestie β this section is just empty. we move.) π
β¨ SEE ALSO β¨
[RTCHit]
and that's the whole page!! thank you for coming to my TED talk π
signed off from the Embree Ray Tracing Kernels 3 manual β this was the RTCRay(3) page, mwah π
π¦ where this page comes from
- epel 9: embree 3.13.5-4.el9 Β· Apache-2.0
- fedora 43: embree3 3.13.5-9.fc41 Β· Apache-2.0
- fedora 44: embree3 3.13.5-16.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms