Jump to content
  • Advertisement
Sign in to follow this  
mgoss

NORMALS wrong place in Collada?

This topic is 2348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sometimes when Maya exports models, it exports them the normals in a different location.

Sometimes it puts the normals under the <vertices>


<vertices id="objgoblin_1-VERTEX">
<input semantic="POSITION" source="#objgoblin_1-POSITION"/>
<input semantic="NORMAL" source="#objgoblin_1-Normal0"/>
</vertices>
<triangles count="7820" material="_3_FBXASC045_Default">
<input semantic="VERTEX" offset="0" source="#objgoblin_1-VERTEX"/>
<input semantic="TEXCOORD" offset="1" set="0" source="#objgoblin_1-UV0"/>
</triangles>

When typically it exports them like this

<vertices id="pCylinder1-VERTEX">
<input semantic="POSITION" source="#pCylinder1-POSITION"/>
</vertices>
<triangles count="120" material="lambert2">
<input semantic="VERTEX" offset="0" source="#pCylinder1-VERTEX"/>
<input semantic="NORMAL" offset="1" source="#pCylinder1-Normal0"/>
</triangles>

What's the difference and why does it export them at two different locations? I would prefer it to always have it in the triangles node. Because I need the offset. Edited by mgoss

Share this post


Link to post
Share on other sites
Advertisement
I don't think you really need an offset. The inputs are always in the same order as in the file. Just read the inputs in the same order and increment the offset by 1 in your code.

For example:

int offset = 0

For every node in triangles

if semantic = "VERTEX"
Find vertices node, for every node in Vertices
ReadInputNode(offset++)

else
ReadInputNode(offset++);

And then in the ReadInputNode function, you would have something like this:

ReadInputNode(int offset)
{
pNode->mOffset = offset

// Read whatever you want from the input node
}


It's not a nice solution, but the COLLADA format sucks. Its exporters suck more.

You can always use the Assimp library to import COLLADA files, makes life much easier.

Edit: Don't mind the gazillion edits, just trying to work out the indents. I spent way too much time on them. They still look like crap. Excuse me while i go search for a life. Edited by Waaayoff

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!