Jump to content
  • Advertisement
Sign in to follow this  
Solid_Spy

Parsing collada files and avoiding duplicate vertices

This topic is 2111 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

Hello, i've been trying to create my own 3d format by parsing a collada file and outputting to a binary file.

 

However, I discovered that collada stores vertex and index data very differently:

<polylist material="Material_001-material" count="2">
          <input semantic="VERTEX" source="#Plane-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Plane-mesh-normals" offset="1"/>
          <vcount>3 3 </vcount>
          <p>1 0 0 0 2 0 3 1 1 1 2 1</p>
        </polylist>

Aparently, the vertexes and indices are supposed to be one in the same. What if I don't want to duplicate a vertice with the same exact data as another one? I have a plane, and I only want to render it using 4 vertices and 6 indices, but it looks like it's forcing me to use 6 vertices.

Share this post


Link to post
Share on other sites
Advertisement

It doesn't really refer to six vertices; according to the <p> index-list "Plane-mesh-vertices" should be a float_array that contains 4 lines and "Plane-mesh-normals" contains 2. All indices are packed into a single stream: <p>VERTEX0 NORMAL0 VERTEX1 NORMAL1 etc. </p>.

 

The second triangle seems to use a different normal, making it impossible to share vertices on the first triangle, which results in two extra duplicated vertices. Most likely the two normals are identical, but still stored individually, so in order to have as little unwelded/duplicated vertices as possible, you'll need to not only differentiate on index, but also on actual value.

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!