A quad mesh (right) provide a more uniform distribution of vertices than the equivalent triangle mesh (left) when hardware tessellation is used.
- Josh Klint, Ultra Software, @ultraengine
Ultra Engine Vendor Extension - Currently supported in Ultra Engine.
Written against the glTF 2.0 spec.
Although they are less common than triangle meshes, 3D models made up of quads (four-sided primtives) provide excellent iterative tessellation. Quad geometry can be evaluated in screen-space more effectively than triangles to provide a more uniform distribution of tessellated vertices, resulting in more accurate display of 3D geometry encoded in a displacement texture, as well as smoother curvature.
Quads are requested by adding the ULTRA_primitive_quads
extension to a primitive rendered with "mode": 4
, TRIANGLES
.
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 0,
"NORMAL": 1
},
"indices": 2,
"material": 0,
"mode": 4,
"extensions": {
"ULTRA_primitive_quads": {
"indices": 3
}
}
}
]
}
]
Type | Description | Required | |
---|---|---|---|
indices | number | The index of the accessor to read quad indices from. | No. |
If the indices property is present, it will be used as the index of an accessor from which quad indices will be read, and the accessor count must be evenly divisible by four.
If the indices property is not present, and the primitive has an indices accessor specified, then the first four of every six indices should be used to add a quad primitive to the mesh, instead of creating triangles. In this case, the indice accessor count must be evenly divisible by six.
If the indices property is not present in the extension or in the primitive, then one quad should be created for every six vertices, and the number of vertices must be evenly divisible by six. The vertex indices to use in quad creation must match the following pattern:
for (int v = 0; v < vertex_count / 6; ++v)
{
int i0 = v * 6 + 0;
int i1 = v * 6 + 1;
int i2 = v * 6 + 2;
int i3 = v * 6 + 3;
}
This extension does not dictate any specific rendering technique for quad meshes. It only provides a mechanism to store meshes with quad geometry.
Although this extension enhances the ability of 3D renderers to display tessellated meshes and displacement mapping, tessellation and displacement features are outside the scope of this specification.
This extension does not interfere with the loading of triangle geometry and provides backwards compatibility with all applications that support glTF 2.0.
Although not all mesh geometry can be represented by quads, quads with tessellation produce a more even distribution of polygons than triangle tessellation. Having the ability to store quad meshes in glTF format enhances our ability to deliver greater visual acuity of tessellated meshes. This extension also allows 3D modeling programs to save and reload meshes without losing quad mesh topology.