vertex normals confusion


#1

I have the following problem: I am writing a tool that needs to generate collada files with cylinders in it. Now I was looking at how (vertex)normals are listed in collada files and I’m really confused.

When I create a cylinder with 5 sides in maya, there are 2 center vertices and 10 vertices on the outside of the cylinder. Now the 2 center vertices have 1 normal each, and the outside vertices have 3. (12 vertices, 32 normals)

When I create a cylinder with 16 sides in maya, there are 2 center vertices and 32 vertices on the outside of the cylinder. Now the 2 center vertices have 1 normal each, and the outside vertices have 2. (34 vertices, 66 normals)

When you export the files, the normals are simply listed without any reference on how much normals each vertex has. So how does this work? How does it know which normal(s) belong to which vertex when you import? Probably normals are sorted according to order of the vertices, but because the number of normals per vertex can differ, I don’t understand how this can work :frowning:

I’m really puzzeled by this, am I missing something obvious? Thanks for any help!

p.s. I’ve tried looking up how vertex normals work, but I only find general information on how they are used in shading etc.


#2

Besides reading the spec, try this tutorial on the wiki:

https://collada.org/mediawiki/index.php/Using_accessors