rtcNewGeometry(3)
π rtcNewGeometry(3) π
okay bestie, welcome to the Embree Ray Tracing Kernels 4 era β this is the rtcNewGeometry page and it's literally the moment your ray tracer gets a whole new geometry to play with. grab a boba, we're doing this π§β¨
β¨ NAME β¨
rtcNewGeometry β creates a new geometry object π¦
πΈ SYNOPSIS πΈ
#include <embree4/rtcore.h>
enum RTCGeometryType
{
RTC_GEOMETRY_TYPE_TRIANGLE,
RTC_GEOMETRY_TYPE_QUAD,
RTC_GEOMETRY_TYPE_SUBDIVISION,
RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE,
RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE,
RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE,
RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE,
RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE,
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE,
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE,
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE,
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE,
RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE,
RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE,
RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE,
RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE,
RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE,
RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE,
RTC_GEOMETRY_TYPE_GRID,
RTC_GEOMETRY_TYPE_SPHERE_POINT,
RTC_GEOMETRY_TYPE_DISC_POINT,
RTC_GEOMETRY_TYPE_ORIENTED_DISC_POINT,
RTC_GEOMETRY_TYPE_USER,
RTC_GEOMETRY_TYPE_INSTANCE,
RTC_GEOMETRY_TYPE_INSTANCE_ARRAY,
};
RTCGeometry rtcNewGeometry(
RTCDevice device,
enum RTCGeometryType type
);
π DESCRIPTION π
so a geometry is basically an object that holds an array of primitives that are all the same type. like, one vibe only, no mixing. and rtcNewGeometry is the function that makes you a brand new geometry of whatever type you asked for, bound to the device you passed in, and it hands you back a handle to that geometry. π«Ά
the geometry object is reference counted, and its initial reference count is 1. when you're done with the handle you release it with the rtcReleaseGeometry API call. yes bestie, you have to let it go β it's not gonna release itself. π
π supported geometry types (the whole roster) π
- triangle meshes β
RTC_GEOMETRY_TYPE_TRIANGLE - quad meshes (they're triangle pairs, sneaky little things) β
RTC_GEOMETRY_TYPE_QUAD - Catmull-Clark subdivision surfaces β
RTC_GEOMETRY_TYPE_SUBDIVISION - curve geometries with different bases β the full lineup is
RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE,RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE,RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE,RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE,RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE,RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE,RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE,RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE,RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE,RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE,RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE,RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE,RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE,RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE,RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE - grid meshes β
RTC_GEOMETRY_TYPE_GRID - point geometries β
RTC_GEOMETRY_TYPE_SPHERE_POINT,RTC_GEOMETRY_TYPE_DISC_POINT,RTC_TYPE_ORIENTED_DISC_POINT - user-defined geometries β
RTC_GEOMETRY_TYPE_USER - instances β
RTC_GEOMETRY_TYPE_INSTANCE - instance arrays β
RTC_GEOMETRY_TYPE_INSTANCE_ARRAY
π round vs flat, the discourse π
the types RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE, RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE, and RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE will treat the curve as a sweep surface of a varying-radius circle swept tangentially along the curve. it's givingβ¦ tube. iconic. π
meanwhile RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE, RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE, and RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE use ray-facing ribbons as a faster-to-intersect approximation. so if you want speed over shape fidelity, that's your girl. β‘
π life after construction π
after construction, geometries are enabled by default and not attached to any scene. like, they exist, they're just not in the group chat yet. π
- you can disable a geometry with the
rtcDisableGeometrycall, and enable it again with thertcEnableGeometrycall. - a geometry can be attached to multiple scenes using the
rtcAttachGeometrycall (or thertcAttachGeometryByIDcall), and detached using thertcDetachGeometrycall. - during attachment, a geometry ID gets assigned to the geometry (or assigned by the user when you use the
rtcAttachGeometryByIDcall), and that ID uniquely identifies the geometry inside that scene. this identifier is what gets returned when primitives of the geometry are hit in later ray queries for the scene. so it's the geometry's @ handle basically. π
π¦ editing your geometry π¦
geometries can also be modified, including their vertex and index buffers. but β and this is important β after modifying a buffer, rtcUpdateGeometryBuffer must be called to notify that the buffer got modified. don't skip it, it will not know. π
the application can use the rtcSetGeometryUserData function to set a user data pointer to its own geometry representation, and later read out this pointer using the rtcGetGeometryUserData function. it's like a little pocket for your own stuff. π
after setting up the geometry or modifying it, rtcCommitGeometry must be called to finish the geometry setup. after committing the geometry, vertex data interpolation can be performed using the rtcInterpolate and rtcInterpolateN functions. β¨
π build quality, for the perfectionists π
a build quality can be specified for a geometry using the rtcSetGeometryBuildQuality function, to balance between acceleration structure build performance and ray query performance. the build quality per geometry will be used if a two-level acceleration structure is built internally, which is the case if the RTC_BUILD_QUALITY_LOW is set as the scene build quality. see Section [rtcSetSceneBuildQuality] for more details. balance queen. βοΈ
π EXIT STATUS π
on failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError. so if you get NULL, don't panic β go ask rtcGetDeviceError what happened. π
π SEE ALSO π
- [rtcEnableGeometry]
- [rtcDisableGeometry]
- [rtcAttachGeometry]
- [rtcAttachGeometryByID]
- [rtcUpdateGeometryBuffer]
- [rtcSetGeometryUserData]
- [rtcGetGeometryUserData]
- [rtcCommitGeometry]
- [rtcInterpolate]
- [rtcInterpolateN]
- [rtcSetGeometryBuildQuality]
- [rtcSetSceneBuildQuality]
- [RTC_GEOMETRY_TYPE_TRIANGLE]
- [RTC_GEOMETRY_TYPE_QUAD]
- [RTC_GEOMETRY_TYPE_SUBDIVISION]
- [RTC_GEOMETRY_TYPE_CURVE]
- [RTC_GEOMETRY_TYPE_GRID]
- [RTC_GEOMETRY_TYPE_POINT]
- [RTC_GEOMETRY_TYPE_USER]
- [RTC_GEOMETRY_TYPE_INSTANCE]
- [RTC_GEOMETRY_TYPE_INSTANCE_ARRAY]
okay that's the whole page bestie, no skips, no cuts, every single flag and type accounted for. go make something gorgeous. π
and that's a wrap on rtcNewGeometry(3) from the Embree Ray Tracing Kernels 4 manual, dated rtcNewGeometry(3) β periodt. π
π
π¦ where this page comes from
- ubuntu stonking: libembree-dev 4.4.1+dfsg-2ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms