RTCRay(3)
π RTCRay(3) π
okay bestie, welcome to the Embree Ray Tracing Kernels 4 manual, and today's main character is RTCRay β the single ray structure. yes, THE ray. the one that does the actual ray-ing. π
β¨ SYNOPSIS β¨
#include <embree4/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; // z 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
};
no cap, that's the whole vibe right there. π
πΈ DESCRIPTION πΈ
so RTCRay defines the ray layout for a single ray. it's giving "one ray, fully described, no notes." π¦
the ray carries:
- its origin β that's the
org_x,org_y,org_zmembers π« - its direction vector β the
dir_x,dir_y,dir_zmembers β¨ - its ray segment β the
tnearandtfarmembers π
and here's a thing bestie, listen up: the ray direction does not have to be normalized. you heard me. only the parameter range specified by the tnear/tfar interval is considered valid. so don't stress about normalizing, that's not the assignment. π
β οΈ okay so this part is important: the ray segment must be in the range [0, β]. that means ranges that start behind the ray origin are not allowed. but bestie, the ranges can reach to infinity. slay. π
the ray further contains a bunch more little guys:
- 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 π©
the ray mask can be used to mask out some geometries for some rays (go peek at rtcSetGeometryMask for more details, iykyk). π«Ά
the ray ID can be used to identify a ray inside a callback function β even if the order of rays inside a ray packet has changed. so like, your ray keeps its name tag at the party no matter how the seating chart gets shuffled. iconic behavior fr fr. π
π§ the SOA situation (still DESCRIPTION, bestie)
the embree4/rtcore_ray.h header additionally defines the same ray structure in structure of array (SOA) layout for API functions accepting ray packets of:
- size 4 β the
RTCRay4type - size 8 β the
RTCRay8type - size 16 β the
RTCRay16type
and the header additionally defines an RTCRayNt template for ray packets of an arbitrary compile-time size. yes, arbitrary. it's giving flexible. it's giving limitless. it's giving template. πβ¨
π« EXIT STATUS π«
not me leaving this section absolutely empty β because it is. nothing here bestie. the void. the silence. π³οΈβ¨
π₯ SEE ALSO π₯
- [RTCHit]
go read about the hit next, it's literally the other half of the story. π
and that's the page, bestie!! π«Ά this was RTCRay(3) from the Embree Ray Tracing Kernels 4 manual β stay hydrated, keep your tnear above zero, and go trace something gorgeous. mwah. π
πΈβ¨
π¦ where this page comes from
- alpine 3.24: embree-doc 4.4.1-r0 Β· Apache-2.0
- arch rolling: embree 4.4.1-1 Β· Apache-2.0
- fedora 43: embree 4.4.1-1.fc43 Β· Apache-2.0
- fedora 44: embree 4.4.1-1.fc44 Β· Apache-2.0
- nixpkgs unstable: embree 4.4.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms