rtcOccluded1(3)

✨ rtcOccluded1 ✨

okay bestie, welcome to rtcOccluded1 from the Embree Ray Tracing Kernels 4 manual, section 3. it's giving "do I hit literally anything?" energy and honestly? iconic. πŸ’…


πŸŽ€ NAME πŸŽ€

rtcOccluded1 β€” finds any hit for a single ray

like. ANY hit. one ray. that's the whole gig. no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <embree4/rtcore.h>

void rtcOccluded1(
  RTCScene scene,
  struct RTCRay* ray,
  struct RTCOccludedArguments* args = NULL
);

yes the args thing defaults to NULL, she's optional, she's low maintenance. 🫢


πŸ’– DESCRIPTION πŸ’–

so what does rtcOccluded1 actually do? it checks, for a single ray (that's your ray argument, bestie), whether there is any hit with the scene (that's your scene argument, obviously πŸ’β™€οΈ). and that optional args struct you can pass in? that's for the advanced use cases, so go read the section on [rtcInitOccludedArguments] if you want the tea on that. β˜•

now, to actually trace a ray, you gotta initialize a whole lil checklist. no skipping steps, this is not a vibe check you can fail:

  • the ray origin β†’ the org ray member
  • the ray direction β†’ the dir ray member
  • the ray segment β†’ the tnear and tfar ray members
  • the ray mask β†’ the mask ray member
  • and you must set the ray flags to 0 β†’ the flags ray member

the ray time (that's the time ray member) has to be initialized to a value in the range [0, 1]. and the ray segment has to be in the range [0, ∞] β€” so ranges that start behind the ray origin are simply not valid, sorry babe, not happening πŸ™ˆ β€” but the ranges can reach all the way out to infinity, which is kinda slay of them. if you want the full ray layout description, go see Section [RTCRay]. πŸ“–

now here's the important part, and I need you to focus:

when no intersection is found, the ray data is not updated. like, at all. untouched. but when a hit was found, the tfar component of the ray gets set to -inf. πŸ’€

and ngl, the implementation makes no guarantees that primitives whose hit distance is exactly at (or very close to) tnear or tfar are hit or missed. that's just the boundary drama we live with. so if you want to exclude intersections at tnear, just pass a slightly enlarged tnear. and if you want to include intersections at tfar, pass a slightly enlarged tfar. tiny little nudge, huge little difference. ✨

oh and one more thing β€” the ray must be aligned to 16 bytes. non-negotiable, bestie. that's the rule. πŸ‘‘


πŸ’€ EXIT STATUS πŸ’€

for performance reasons, this function does not do any error checks. like, zero. so on failure it will not set any error flags. she simply does not snitch. 🀐


πŸ‘€ SEE ALSO πŸ‘€

go read these too, they're all part of the same friend group:

  • [rtcIntersect1]
  • [rtcOccluded4/8/16]
  • [RTCRay]
  • [rtcInitOccludedArguments]

and that's the whole page, bestie!! this was rtcOccluded1(3) straight out of the Embree Ray Tracing Kernels 4 manual β€” go forth and occlude, you absolute main character. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from