RTC_GEOMETRY_TYPE_QUAD(3embree3)
π RTC_GEOMETRY_TYPE_QUAD π
okay bestie, welcome to the RTC_GEOMETRY_TYPE_QUAD page from the Embree Ray Tracing Kernels 3 manual π
this is the one that tells you how quads work. quad geometry type. that's the whole vibe. let's go π¦
β¨ NAME β¨
RTC_GEOMETRY_TYPE_QUAD β quad geometry type, aka the four-cornered icon of the mesh world π
πΈ SYNOPSIS πΈ
#include <embree3/rtcore.h>
RTCGeometry geometry =
rtcNewGeometry(device, RTC_GEOMETRY_TYPE_QUAD);
π DESCRIPTION π
Quad meshes are literally created by passing RTC_GEOMETRY_TYPE_QUAD into the rtcNewGeometry function call. that's it, that's the birth of a quad mesh π
So how do you feed it? Two ways, two buffers, no cap:
- the quad indices get specified by setting an index buffer β that's the
RTC_BUFFER_TYPE_INDEXtype - the quad vertices get specified by setting a vertex buffer β that's the
RTC_BUFFER_TYPE_VERTEXtype
and if you're like "bestie how do I even set buffers", go read rtcSetGeometryBuffer and rtcSetSharedGeometryBuffer, they have all the deets π«Ά
Now the nitty gritty:
- the index buffer holds an array of four 32-bit indices per quad, in
RTC_FORMAT_UINT4format, and the number of primitives is inferred from the size of that buffer π - the vertex buffer holds an array of single precision
x,y,zfloating point coordinates, inRTC_FORMAT_FLOAT3format, and the number of vertices is inferred from the size of that buffer π - the vertex buffer can be at most 16 GB large, so like, don't go feral
π§ How a quad actually behaves internally π§
Not me exposing the quad's whole private life but okay: internally a quad is handled as a pair of two triangles, v0,v1,v3 and v2,v3,v1, and the u'/v' coordinates of that second triangle get corrected by u = 1-u' and v = 1-v' so that the resulting quad parametrization has u and v both in the range 0 to 1 β¨
So the parametrization of a quad uses:
- the first vertex
p0as the base point - the vector
p1 - p0as the u-direction - the vector
p3 - p0as the v-direction
which means vertex attributes t0,t1,t2,t3 can be bilinearly interpolated over the quadrilateral like this, periodt:
t_uv = (1-v)((1-u)*t0 + u*t1) + v*((1-u)*t3 + u*t2)
π Mixed triangle/quad meshes π
Yes bestie, you CAN have both. Mixed triangle/quad meshes are supported by encoding a triangle as a quad β you do that by replicating the last triangle vertex:
v0,v1,v2 -> v0,v1,v2,v2
and the way that works is that the second triangle becomes a line (which can never get hit, so don't worry about it π), and the parametrization of the first triangle stays compatible with the standard triangle parametrization. slay π
π Winding + normals π
A quad whose vertices are laid out counter-clockwise has its geometry normal pointing upwards outside the front face, like illustrated in the following picture. iconic behavior fr fr.
β Multi-segment motion blur β
For multi-segment motion blur, the number of time steps must first be specified using the rtcSetGeometryTimeStepCount call. Then you can set a vertex buffer for each time step using different buffer slots β and all these buffers must have the same stride and size. no exceptions, no shortcuts, the buffers are matching or they're nothing π
π EXIT STATUS π
On failure, NULL is returned and an error code is set that you can query using rtcGetDeviceError. so like, check it. please. for me π₯Ί
π¦ SEE ALSO π¦
- [
rtcNewGeometry]
and that's the whole page bestie, you're officially a quad girlie now π β¨
signing off from the RTC_GEOMETRY_TYPE_QUAD(3) page of the Embree Ray Tracing Kernels 3 manual β stay interpolated, stay bilinear, and remember: 16 GB max on that vertex buffer π«Άππ
π¦ 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