RTC_GEOMETRY_TYPE_GRID(3embree3)

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

✨ RTC_GEOMETRY_TYPE_GRID ✨

okay bestie, welcome to the grid geometry type page from the Embree Ray Tracing Kernels 3 manual πŸ’– this one's a whole vibe, let's get into it.


🌸 NAME 🌸

RTC_GEOMETRY_TYPE_GRID β€” the grid geometry type, no cap, that's literally what it is πŸ¦‹


πŸ’… SYNOPSIS πŸ’…

#include <embree3/rtcore.h>

RTCGeometry geometry =
  rtcNewGeometry(device, RTC_GEOMETRY_TYPE_GRID);

πŸŽ€ DESCRIPTION πŸŽ€

So grid meshes? You make them by handing RTC_GEOMETRY_TYPE_GRID over to the rtcNewGeometry function call, and boom, you've got an array of grid primitives living inside. ✨

To set that array of grids up, you build a grid buffer β€” that's type RTC_BUFFER_TYPE_GRID with format RTC_FORMAT_GRID β€” and then you set the grid mesh vertices with a vertex buffer, which is type RTC_BUFFER_TYPE_VERTEX. Need the deets on buffer-setting? Go read rtcSetGeometryBuffer and rtcSetSharedGeometryBuffer, they got you 🫢. And the number of grid primitives in the grid mesh? It's inferred from the size of the grid buffer. Just like, vibes-based but make it exact.

The vertex buffer holds an array of single precision x, y, z floating point coordinates (that's RTC_FORMAT_FLOAT3 format, bestie), and the number of vertices is inferred from the size of that buffer. πŸ‘‘

Every single grid in the grid buffer is of the type RTCGrid, and she looks like this:

struct RTCGrid
{
  unsigned int startVertexID;
  unsigned int stride;
  unsigned short width,height;
};

The RTCGrid structure describes a 2D grid of vertices β€” with respect to the vertex buffer of the grid mesh, iykyk. The width and height members specify the number of vertices in the u and v direction, so like, if you set both width and height to 3 you've set up a 3Γ—3 vertex grid. Slay. The maximum allowed width and height is 32767 β€” do not test her, she will not go higher πŸ’€.

The startVertexID specifies the ID of the top-left vertex in the vertex grid, while the stride parameter specifies a stride (in number of vertices) used to step to the next row. Lowkey essential.

A vertex grid of dimensions width and height gets treated as a (width-1) x (height-1) grid of quads (triangle-pairs), with the exact same shared edge handling as for regular quad meshes. But here's the twist, bestie: the u/v coordinates have the uniform range [0..1] for an entire vertex grid. The u direction follows the width of the grid while the v direction follows the height. It's giving coordinates but make it normalized 🌈

For multi-segment motion blur, the number of time steps must be specified first, using the rtcSetGeometryTimeStepCount call. Then a vertex buffer for each time step can be set using different buffer slots, and all these buffers must have the same stride and size. Not optional, not negotiable, that's the rule ⭐


πŸ”₯ 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, check the error, she's trying to tell you something 😭


πŸ’œ SEE ALSO πŸ’œ

  • rtcNewGeometry

and that's the whole page, bestie β€” this was the RTC_GEOMETRY_TYPE_GRID(3) entry from the Embree Ray Tracing Kernels 3 manual, straight from the group chat to your terminal πŸ’–βœ¨πŸ¦‹πŸŽ€ stay iconic, go build some grids, periodt πŸ’…πŸ‘‘

πŸ“¦ where this page comes from