RTC_GEOMETRY_TYPE_USER(3embree3)
π RTC_GEOMETRY_TYPE_USER(3) β user geometry type π
okay bestie, welcome to the Embree Ray Tracing Kernels 3 manual, section 3, and today's main character is RTC_GEOMETRY_TYPE_USER. sit down, hydrate, let's get into it π«Ά
β¨ NAME β¨
RTC_GEOMETRY_TYPE_USER β the user geometry type. yes that's literally it, that's the whole name, she's simple and she's iconic π
πΈ SYNOPSIS πΈ
#include <embree3/rtcore.h>
RTCGeometry geometry =
rtcNewGeometry(device, RTC_GEOMETRY_TYPE_USER);
look at her. two lines. no cap, that's the whole vibe check right there β¨
π¦ DESCRIPTION π¦
So here's the tea, bestie: user-defined geometries hold a bunch of user-defined primitives, the exact same way triangle meshes hold a bunch of triangles. like, same energy, different shape. and the shape of those primitives? that's all you, because you specify it through registered callback functions β which is the whole slay, because it means you can extend Embree with literally any type of primitive you can dream up π
You create user-defined geometries by passing RTC_GEOMETRY_TYPE_USER to the rtcNewGeometry function call. easy. but then you have to actually set things up, and there's a lil checklist, so let's go:
- set the number of primitives (peep
rtcSetGeometryUserPrimitiveCount) - set a user data pointer (that's
rtcSetGeometryUserData) - set a bounding function closure (hi
rtcSetGeometryBoundsFunction) - set your user-defined intersect callback (say hey to
rtcSetGeometryIntersectFunction) - and set your occluded callback (
rtcSetGeometryOccludedFunction, obviously)
The bounding function is what gets used to query the bounds of all time steps of a user primitive. meanwhile the intersect and occluded callback functions get called when it's time to intersect the primitive with a ray. and the user data pointer? that gets passed to each callback invocation, and it's there so you can point at your application's representation of the user geometry. it's giving personal assistant for your primitives, fr fr π
The creation of a user geometry typically looks the following:
RTCGeometry geometry = rtcNewGeometry(device, RTC_GEOMETRY_TYPE_USER);
rtcSetGeometryUserPrimitiveCount(geometry, numPrimitives);
rtcSetGeometryUserData(geometry, userGeometryRepresentation);
rtcSetGeometryBoundsFunction(geometry, boundsFunction);
rtcSetGeometryIntersectFunction(geometry, intersectFunction);
rtcSetGeometryOccludedFunction(geometry, occludedFunction);
okay but like β please have a look at the rtcSetGeometryBoundsFunction, rtcSetGeometryIntersectFunction, and rtcSetGeometryOccludedFunction functions for the actual implementation of the callback functions. do not just copy this block and hope, bestie, i'm begging π
β οΈ big important one: primitives of a user geometry are ignored during rendering when their bounds are empty β meaning the bounds have lower>upper in at least one dimension. so if your primitive is mysteriously invisible, check the bounds, not your feelings π
See tutorial [User Geometry] for an example of how to use the user-defined geometries. go read it, she ate π₯
π EXIT STATUS π
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError. so if you get NULL, it's not you, it's the error code β go check it π
π SEE ALSO π
- [rtcNewGeometry]
- [rtcSetGeometryUserPrimitiveCount]
- [rtcSetGeometryUserData]
- [rtcSetGeometryBoundsFunction]
- [rtcSetGeometryIntersectFunction]
- [rtcSetGeometryOccludedFunction]
the whole friend group, all linked up, all essential πΈ
and that's the page, bestie!! this was RTC_GEOMETRY_TYPE_USER(3) from the Embree Ray Tracing Kernels 3, and she understood the assignment. go build some cursed custom primitives, ily, mwah πβ¨ππ¦
π¦ 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