RTCRay(3)

πŸ“¦ version 3.13.5, in epel 9, fedora 43, fedora 44

🌸 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_z members
  • the direction vector β€” the dir_x, dir_y, dir_z members
  • the ray segment β€” the tnear and tfar members

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 the time member ⏰
  • a ray mask β€” the mask member
  • a ray ID β€” the id member
  • ray flags β€” the flags member

so about those:

  • the ray mask can be used to mask out some geometries for some rays. (peep rtcSetGeometryMask if 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 β†’ RTCRay4 type
  • size 8 β†’ RTCRay8 type
  • size 16 β†’ RTCRay16 type

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