Geometry Data

Recently I ran across Collada after a friend recommended it to me as I was looking for a nice open format with alot of features. I fell in love with Collada and love what I can do with it.

So I am primarily a .Net programmer to the core. Thus I have written and tweaked a usable .Net based DOM for Collada. Importing data is working great, exporting needs some fixes here and there but overall things have went well.

Now, the next step I am on is interpreting the data from the Collada document. This is where I am stuck. I cannot seem to grasp how geometry data such as Normals and Texture Coordinates relates to each Vertex of a model. I have no problem building a model onscreen using position data from the Collada Document, but when it comes to reading the Normal and Texture Coordinate data from the document and assigning those to Vertices I am lost. Is there somewhere I can look for a clearer explanation of how these relate to one another? The Collada Document spec doesn’t really shed much light on this topic for me.

There are many places you can look at.
The book would most certainly be very helpful to get a better understanding.

In addition, you can look into the many samples available:

C#/XNA
C++
Java

The normals and texture coordinates are associated with vertices in a primitive element such as <triangles>, <tristrips>, etc.

<triangles material="myMaterial" count="1">
  <input semantic="VERTEX" source="#myVertices" offset="0"/>
  <input semantic="NORMAL" source="#myNormals" offset="1"/>
  <input semantic="TEXCOORD" source="#myTexCoords" offset="2"/>
  

0 0 9 2 1 11 3 2 10</p>
</triangles>

The offset attribute in each <input> tells you where to look in the

for that input. In this example the vertices are offset 0, normals are offset 1, and tex coords are offset 2. The

element starts with 0 0 9. These elements make up the first full vertex, where the position is at location 0 of the positions array, the normal is location 0 in the normal array, and the tex coord is at location 9 of the tex coord array. Then the next vertex is described by the indices 2 1 11, and then the next vertex is 3 2 10, which completes the first (and in this case only) triangle.

Good luck and welcome to Collada :slight_smile:

Thanks for the reccomendations Remi.

And thankyou sthomas for the explanation. I guess I started thinking a bit to deeply about how geometric data was organized and got lost in my own thoughts, did not realize it was so simple.

And thus we have the fruit of my labors:


Link


Link

From here on out things look to be much easier and smoother sailing. I am going to be working with the Seymour file more and getting animation rigged up. I hope to have a public release of my Collada.Net XNA loader really soon.