Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I made a simple teapot with the "Create Standard Primitives" option and exported it as a collada file, ended up with this:

< float_array id="Teapot001-POSITION-array" count="1590">

< float_array id="Teapot001-Normal0-array" count="9216">

For what I know there should be only one normal per vertex, am I wrong? What am I supposed to do with that much normals? Just put them on the normal buffer all at once normally?

share|improve this question
2  
Actually, you can have more than one normal per vertex, which is not normally the case. In this case, I think the justification for those numbers is that a vertex position can repeat, with different colors, texcoords and normals. There must be some indexing going on, to associate vertex position and normals. –  Grimshaw Mar 22 '12 at 2:50
    
Actually the .dae file doesn't have any index array. Which I found very weird too. –  Delta Mar 22 '12 at 2:54
    
How come? Try to check the number of vertices in 3DS MAX, and find out what the numbers mean exactly.. –  Grimshaw Mar 22 '12 at 2:58
    
Do you know if these are face normals or vertex normals? I'm not familiar with 3ds Max (I use Maya myself), but I'm fairly certain there's something like an Edit Normals modifier that you could use to see what the normals looked like in max. –  K.G. Mar 22 '12 at 4:31

3 Answers 3

At least one case that this can happen is when you have multiple smoothing groups on an object. So a vertex can have as many normals as it has faces with different smoothing groups sharing it.

http://wiki.polycount.com/SmoothingGroups

share|improve this answer

Its the way Collada indexes things, Collada indexes the vertices, normals and other information separately, to save space in some cases. For example when you store a plane with allot of vertices and also allot of normals all pointing to the same direction, In the way collada stores the information it only has to give you a array of normal indices all point to the same normal vector pointing up in this case.

share|improve this answer

This is a common problem with many formats exported from modeling tools. It shows up in FBX as well. The simple truth is that you need to take the triangle list as master, unwind the individual indices, and construct a completely unindexed mesh. You can either leave it that way or recompute the indices by vertex deduplication. There's no way around this step and it's yet another reason that people avoid using interchange formats like FBX and Collada directly as game assets.

IMO the easiest way to reconstruct new indices is to create a Vertex struct with an operator<, and then insert all the vertices into a std::map(Vertex, unsigned int). Then you can scan over the vertices again, looking up their indices from the map, and create an index buffer that way. I'm sure this isn't the fastest way, but it's very straightforward to write.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.