COLLADA keeps numbers in source elements and reads them through
input elements, the same way for meshes, skins, morphs and animation.
This page follows the COLLADA 1.4.1 schema.
Sources and arrays
A source (id, name) holds one array and a
technique_common with an accessor that says how to read
it.
| Array | Holds | Attributes besides id, name, count |
|---|---|---|
float_array | numbers | digits (default 6) and magnitude (default 38): the precision of the source data |
int_array | integers | minInclusive, maxInclusive |
bool_array | true and false | |
Name_array | names, such as joint names or interpolation types | |
IDREF_array | ids of other elements |
Values are separated by white space; count is the number of values.
The accessor has source (the array’s URL),
count (the number of elements), offset (default 0, the
first value used) and stride (default 1, values per element), and one
param per value of an element, each with name (such as
X, Y, Z, S, T,
R, G, B), type (such as
float, float4x4, name) and optional
sid and semantic. A param without a name is
skipped, which lets a reader take only some values of each element.
Inputs
An input joins a meaning to a source: semantic (the
meaning) and source (its URL). Inside primitives, skins’ vertex weights
and morphs’ targets it also has offset (which index of each group in
p or v it reads) and optionally set (for
example which texture coordinate set).
| Semantic | Meaning |
|---|---|
BINORMAL | geometric binormal (bitangent) vectors |
COLOR | colours |
CONTINUITY | continuity constraints at control vertices |
IMAGE | raster or MIP-level input |
INPUT | sampler input: key times |
IN_TANGENT | tangents entering a key |
INTERPOLATION | sampler interpolation type per key |
INV_BIND_MATRIX | inverse bind matrices of joints |
JOINT | skin influence names or ids |
LINEAR_STEPS | number of linear steps for a spline segment |
MORPH_TARGET | morph targets |
MORPH_WEIGHT | morph weights |
NORMAL | normals |
OUTPUT | sampler output: values |
OUT_TANGENT | tangents leaving a key |
POSITION | positions |
TANGENT | geometric tangents |
TEXBINORMAL | texture binormals |
TEXCOORD | texture coordinates |
TEXTANGENT | texture tangents |
UV | generic parameters |
VERTEX | the mesh’s vertices element: all of its per-vertex inputs at once |
WEIGHT | skin influence weights |
Meshes
A geometry holds a mesh, a convex_mesh or a
spline (with a closed attribute and
control_vertices). A mesh holds one or more
sources, exactly one vertices (an id and
inputs, at least POSITION, that describe each vertex), and any number of
primitives:
| Primitive | Index children | Shape |
|---|---|---|
triangles | one p | three vertices per triangle |
polylist | vcount (vertices per polygon), one p | polygons of any size |
polygons | one p per polygon, or ph with a p and h holes | polygons, possibly with holes |
lines | one p | two vertices per line |
linestrips | one p per strip | connected lines |
trifans | one p per fan | triangle fans |
tristrips | one p per strip | triangle strips |
Each primitive has count (required: the number of triangles, lines,
polygons, strips or fans), an optional material (a symbol bound in
bind_material) and name, then its inputs. In
p, each vertex takes one index per distinct offset, so a
vertex is (largest offset + 1) integers long; each input reads the index at its
offset. The VERTEX input brings in everything in
vertices.
Example
<mesh>
<source id="pos">
<float_array id="pos-array" count="9">0 0 0 1 0 0 0 1 0</float_array>
<technique_common>
<accessor source="#pos-array" count="3" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="nrm"> … one normal, 0 0 1 … </source>
<vertices id="verts">
<input semantic="POSITION" source="#pos"/>
</vertices>
<triangles count="1" material="Paint">
<input semantic="VERTEX" source="#verts" offset="0"/>
<input semantic="NORMAL" source="#nrm" offset="1"/>
<p>0 0 1 0 2 0</p>
</triangles>
</mesh>
p is a vertex index then a
normal index