rtcSetGeo...dFunction(3)

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

✨ rtcSetGeometryOccludedFunction β€” like, the occluded-callback setter ✨

okay bestie, this one lives in the Embree Ray Tracing Kernels 3 manual, and it's page rtcSetGeo...dFunction(3). Let's get into it πŸ’…


πŸŽ€ NAME πŸŽ€

rtcSetGeometryOccludedFunction β€” sets the callback function to test a user geometry for occlusion


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <embree3/rtcore.h>

struct RTCOccludedFunctionNArguments
{
  int* valid;
  void* geometryUserPtr;
  unsigned int primID;
  struct RTCIntersectContext* context;
  struct RTCRayN* ray;
  unsigned int N;
  unsigned int geomID;
};

typedef void (*RTCOccludedFunctionN)(
  const struct RTCOccludedFunctionNArguments* args
);

void rtcSetGeometryOccludedFunction(
  RTCGeometry geometry,
  RTCOccludedFunctionN filter
);

πŸ’– DESCRIPTION πŸ’–

so, rtcSetGeometryOccludedFunction registers a ray/primitive occlusion callback function (that's the filter argument) for the user geometry you point at (that's the geometry argument). that's the whole job. iconic.

only ONE callback function can be registered per geometry, and if you call this again it just overwrites whatever was there before. no take-backs, no stacking. and if you pass NULL as the function pointer, boom β€” the registered callback function is disabled. periodt.

the callback you register gets invoked by rtcOccluded-type ray queries, and its job is to test whether the rays in a packet of variable size are occluded by a user-defined primitive. the callback is of type RTCOccludedFunctionN and it gets a whole lil bundle of arguments through the RTCOccludedFunctionNArguments structure:

  • N β€” the ray packet size ✨
  • valid β€” points to an array of integers that say whether the corresponding ray is valid (-1) or invalid (0) πŸ‘€
  • geometryUserPtr β€” points to the geometry user data you previously set through rtcSetGeometryUserData 🫢
  • context β€” points to the intersection context passed to the ray query 🌸
  • ray β€” points to a ray packet of variable size N πŸ”₯
  • geomID and primID β€” identify the geometry ID and primitive ID of the primitive to intersect πŸ‘‘

now the actual task, bestie: intersect each active ray from the ray packet with the specified user primitive. that's it. and here's the rules:

  • if the user-defined primitive is missed by a ray of the ray packet, just return without modifying the ray. nothing happened, we move on πŸ’…
  • if an intersection of the user-defined primitive with the ray was found in the valid range (from tnear to tfar), you should set the tfar member of the ray to -inf πŸ’€ (yes really, that's the move)

also, a primitive might have multiple intersections with a ray, so if you want filtering of intersections, the occlusion filter function needs to be invoked by the user geometry occlusion callback for each encountered intersection. you do that through the rtcFilterOcclusion call. no skipping, fr fr.

and good news: within the user geometry occlusion function, it is safe to trace new rays and create new scenes and geometries. go wild, main character energy ✨🌈


🌈 EXIT STATUS 🌈

on failure, an error code gets set, and you can query it with rtcGetDeviceError. so if something's giving nothing, check there πŸ™ˆ


⭐ SEE ALSO ⭐

  • [rtcSetGeometryIntersectFunction]
  • [rtcSetGeometryUserData]
  • [rtcFilterOcclusion]

and that's the page, bestie πŸŽ€ that was rtcSetGeo...dFunction(3) from the Embree Ray Tracing Kernels 3 manual, version 3, and yes the footer's date is just the title and manual name doing their lil repeated thing down at the bottom. slay, go occlude something πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from