rtcSetGeo...dFunction(3)
β¨ 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 throughrtcSetGeometryUserDataπ«Άcontextβ points to the intersection context passed to the ray query πΈrayβ points to a ray packet of variable sizeNπ₯geomIDandprimIDβ 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
tneartotfar), you should set thetfarmember 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
- 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