Graphics Reference
In-Depth Information
WebGL engines are still young, and most either use an ad-hoc custom asset
format or support a subset of COLLADA. WebGL engines will benefit from a
carefully crafted runtime format and a supporting open-source content pipeline.
We spoke with game developers with established OpenGL and OpenGL ES
engines, and their feedback on glTF is pretty consistent: it is a good idea but they
usually have their own format and content pipeline already in place. However,
for new engines and independent developers, whose growth has been phenome-
nal recently, glTF lowers the barriers to integrate 3D content without requiring
heavier solutions.
2.4 Birds-Eye View
A glTF asset is made up of components familiar to most graphics developers
such as nodes, meshes, and materials. Figure 2.3 shows the organization of the
top-level glTF properties, i.e., properties whose parent is the glTF asset's root. A
design goal is to provide the required structure without unnecessary indirection
and overhead.
At the highest level, a scene is composed of one or more root nodes. Nodes
have a transform, e.g., a 4
4 matrix, and an array of child nodes, forming a
node hierarchy that positions each node in the scene. A node can contain either
a camera, a light, or an array of meshes, which is the most common case.
A mesh contains an array of primitives (not shown in Figure 2.3 because they
are not a top-level glTF property), each of which references attributes and indices
defining the mesh's geometry, and a material defining its shading.
An attribute defines the section of a bufferView that contains data for one
attribute in the mesh, including a stride, so multiple attributes can be interleaved
in the same bufferView , and a bounding box, so the runtime engine doesn't
need to recompute a bounding volume. Similarly, indices define a section of a
bufferView containing index data for a mesh. Of course, different meshes may
point to the same attributes or indices just like different nodes may point to the
same mesh.
bufferView s point to a subset of a buffer, which can reference an external
.bin file or have the binary data encoded in the JSON. There can be one or more
buffers, and a single buffer can contain heterogeneous data, e.g., vertex attributes
and indices.
In addition to referencing attributes and indices, a primitive in a mesh also
references a material, which is an instance of a technique, i.e., a technique plus
its parameter inputs, which correspond to GL uniforms, including textures and
their sampler state. A technique defines the parameter inputs and a pass that
defines the attribute inputs, the shader program containing vertex and fragment
shaders, and the render states. Like buffers, shader source and image files may
be stored in external files or embedded in the JSON.
×
Search WWH ::




Custom Search