rtcInitPo...anceStack(3)
π rtcInitPointQueryInstanceStack β the glow-up your point query stack deserves
okay bestie, come sit with me because this one is from the Embree Ray Tracing Kernels 3 manual and it's literally the setup ritual for point-query instancing. no cap. π
β¨ NAME β¨
rtcInitPointQueryInstanceStack β initializes the stack of (multilevel-)instance information for point queries π
π¦ SYNOPSIS π¦
#include <embree3/rtcore.h>
struct RTC_ALIGN(16) RTCPointQueryInstanceStack
{
// accumulated 4x4 column major matrices from world to instance space.
float world2inst[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
// accumulated 4x4 column major matrices from instance to world space.
float inst2world[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
// instance ids.
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
// number of instances currently on the stack.
unsigned int size;
};
void rtcInitPointQueryInstanceStack(
struct RTCPointQueryInstanceStack* instStack
);
like. look at that struct. it's giving organized. πΈ
π DESCRIPTION π
so there's this stack β the RTCPointQueryInstanceStack type β and what it does is store the IDs and the instance transformations while a BVH traversal is happening for a point query. it's the little notebook that remembers where you are in the instancing chain. β¨
the rtcInitPointQueryStack function initializes the stack to default values and should be called for initialization. (yes bestie, that's the name the manual uses right here β rtcInitPointQueryStack β I'm not editing the source material, I'm just the messenger π«Ά)
this stack gets passed as an argument to the point query callback function (see [rtcSetGeometryPointQueryFunction]) and you should use it to pass instance information down the instancing chain for user defined instancing. if you want a reference implementation of point queries with user defined instancing, go look at the tutorial [ClosestPoint]. it's iconic. π
also important: the stack is a necessary argument to [rtcPointQuery], and Embree internally uses the topmost instance tranformation of the stack to transform the point query into instance space. so like, you can't skip it. main character behavior only. π
π EXIT STATUS π
No error code is set by this function.
that's it. no drama, no error code, she just vibes. π
π SEE ALSO π
- [
rtcPointQuery] - [
rtcSetGeometryPointQueryFunction]
fr fr, the one thing to remember: init the stack before you hand it over, because Embree is gonna reach for the topmost instance tranformation whether you're ready or not. π
and that's a wrap on this page, which lives in the Embree Ray Tracing Kernels 3 manual β yes, the footer is just the title again, rtcInitPo...anceStack(3), because even manpage footers know how to keep the same energy top to bottom. π stay initialized, bestie.
π¦ where this page comes from
- ubuntu jammy: libembree-dev 3.12.2+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms