rtcInitPo...anceStack(3)

πŸ“¦ version 3.12.2, in ubuntu jammy

πŸ’… 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