rtcNewGeometry(3)

πŸ“¦ version 3.13.5, in epel 9, fedora 43, fedora 44

πŸ’– rtcNewGeometry β€” the glow-up page for Embree Ray Tracing Kernels 3 πŸ’–

okay so bestie, welcome to the rtcNewGeometry(3) manual page, but make it cute. this one lives in the Embree Ray Tracing Kernels 3 family and it's literally the "birth a geometry" call. let's get into it 🫢


✨ NAME ✨

rtcNewGeometry β€” creates a new geometry object. that's it, that's the whole job, and she does it flawlessly πŸ’…


✨ SYNOPSIS ✨

#include <embree3/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
};

RTCGeometry rtcNewGeometry(
  RTCDevice device,
  enum RTCGeometryType type
);

✨ DESCRIPTION ✨

so like, geometries are objects that represent an array of primitives of the same type. same type only, no mixing, she's monogamous like that πŸ’€

rtcNewGeometry creates a new geometry of the specified type (that's the type argument) bound to the specified device (that's the device argument), and it hands you back a handle to this geometry. πŸŽ€

the geometry object is reference counted with an initial reference count of 1. when you're done with it, release that handle using the rtcReleaseGeometry API call. don't ghost her, actually release her ✨


🌈 supported geometry types (the whole roster, no skips)

  • triangle meshes β€” type RTC_GEOMETRY_TYPE_TRIANGLE
  • quad meshes (that's triangle pairs, iykyk) β€” type RTC_GEOMETRY_TYPE_QUAD
  • Catmull-Clark subdivision surfaces β€” type RTC_GEOMETRY_TYPE_SUBDIVISION
  • curve geometries with different bases β€” types 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 β€” type RTC_GEOMETRY_TYPE_GRID
  • point geometries β€” types RTC_GEOMETRY_TYPE_SPHERE_POINT, RTC_GEOMETRY_TYPE_DISC_POINT, RTC_TYPE_ORIENTED_DISC_POINT
  • user-defined geometries β€” type RTC_GEOMETRY_TYPE_USER
  • instances β€” type RTC_GEOMETRY_TYPE_INSTANCE

πŸ¦‹ the curve lore (pay attention bestie)

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. that's giving real geometry energy, no cap πŸŒ€

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. faster, slightly less fancy, still slaying.


πŸŽ€ life cycle stuff (enabled, attached, detached, assigned)

after construction, geometries are enabled by default and not attached to any scene. so she's awake but not in the group chat yet.

  • geometries can be disabled β€” that's the rtcDisableGeometry call
  • and enabled again β€” that's the rtcEnableGeometry call

a geometry can be attached to multiple scenes using the rtcAttachGeometry call (or the rtcAttachGeometryByID call), and detached using the rtcDetachGeometry call.

during attachment, a geometry ID is assigned to the geometry (or assigned by the user when using the rtcAttachGeometryByID call), which uniquely identifies the geometry inside that scene. this identifier is returned when primitives of the geometry are hit in later ray queries for the scene. so like, that's how you know who got hit πŸ‘‘


πŸ’œ modifying stuff

geometries can also be modified, including their vertex and index buffers. after modifying a buffer, rtcUpdateGeometryBuffer must be called to notify that the buffer got modified. must. she doesn't read minds, bestie.

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. cute little pocket for your own stuff πŸ“


⭐ committing + interpolating

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. commit first, interpolate second, that's the order, periodt ✨


πŸ‘‘ build quality

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. go read that one, she's the source of truth 🧚


✨ EXIT STATUS ✨

on failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError. so if you get nothing back, go ask rtcGetDeviceError what went down 😭

lowkey always check the error code. NULL is not a vibe, it's a signal.

✨ 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]

and that's the whole page, bestie πŸ’– this one came to you straight out of Embree Ray Tracing Kernels 3, filed under rtcNewGeometry(3), and yeah the date is whatever it says at the bottom of the original, she's timeless like that πŸ’… go make some geometries, you're gonna ate πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from