I came across quite a few posts in this forum that touches upon with deindexing/unifying indices which I need to do to render in OpenGL using buffering techniques which only accept one array of indices for all the various data that need to be bufffered (vertices/normals/texcoords) using drawElements, whereas collada uses multiple indices (within <triangles>
for eg.) to reference each of the data/channels. I’m afraid none of the previous posts are completely clear (atleast to me). I was wondering if it would be possible in this thread to hammer out some of the finer details on how to do this.
To begin with I would like to reference this post that mentions this in brief, pointing to the ColladaRefinery’s deindexer. What I would like to do is do the deindexing myself (esp. since ColladaRefinery is Windows only afaics).
Specifically, my question relates to redundant vertex information. It seems that collada files can use one normal per polygon per vertex, especially to account for smoothing related to the same vertex being part of multiple polys. Thus its possible to have far more normals than vertices and in the combined index, each vertex can be associated with multiple normals. For eg. slightly modifying the discussion here, within a double offset primitives
tag, we can find (substituting index literals with v1, n1 etc.):
<triangles count="2" material="matl_name"> <input offset="0" semantic="VERTEX" source="#Model-Geometry-Vertex"/> <input offset="1" semantic="NORMAL" source="#Model-Geometry-Normals"/> v1 n21 v2 n32 v3 n29 v3 n11 v4 n43 v6 n98 </p> </triangles>
Won’t the process of unifying the vertex indices by creating duplicate vertices for each of the multiple normals for that vertex defeat the very purpose of reducing reduntant information being transferred, which is an advantage offered by vertex arrays in openGL? Is this an evil I’ll need to live with if I need to buffer data? Or am I misunderstanding the way to go about deindexing/unifying indices?