Implementing a collada reader for my game.

Hello.

I’m trying to implement a collada reader for my game, with the aim to :

  • edit mesh from 3ds max
  • export the mesh in a .dae
  • read the .dae by my game engine
  • create the mesh in the game engine by translation of the file to one or more vertex array
  • export the mesh in optimized binary file.

I’m having issue to understand how to read the collada file for mesh. I’m trying to export a random mesh from 3ds max wich have 3 materials assigned to it.

BUT, in the .dae, I have 3 <triangles>, one per material, with the exact number of indices! Also, the indices of the triangles are all the sames for each 3 <triangles>. If I understand right, each <triangles> should have the indices of the triangles using the corresponding material. Do I understand it right? Should I use a particular option in 3DS max to have my <triangles> correctly composed?


<triangles count="388" material="Concrete">
<input semantic="VERTEX" offset="0" source="#Terrain-VERTEX"/>
<input semantic="NORMAL" offset="1" source="#Terrain-Normal0"/>
<input semantic="TEXCOORD" offset="2" set="0" source="#Terrain-UV0"/>
<p>...</p>
</triangles>
<triangles count="388" material="Road">
<input semantic="VERTEX" offset="0" source="#Terrain-VERTEX"/>
<input semantic="NORMAL" offset="1" source="#Terrain-Normal0"/>
<input semantic="TEXCOORD" offset="2" set="0" source="#Terrain-UV0"/>
<p>... </p>
</triangles>
<triangles count="388" material="Grass">
<input semantic="VERTEX" offset="0" source="#Terrain-VERTEX"/>
<input semantic="NORMAL" offset="1" source="#Terrain-Normal0"/>
<input semantic="TEXCOORD" offset="2" set="0" source="#Terrain-UV0"/>
<p>...</p>
<triangles>

With regards, Spidyy

Friend , I can’t understood you ,what is the point ?

The point is : why do I have the same triangles for each materials, when the materials are applied on different triangles under 3ds max?

Maybe it has the same triangles indeed,change other models and try

I checked my 3ds model multiple time, asked a 3D artist friend to check it too, nothing’s wrong. I read the default COLLADA exporter of 3ds max is somewhat buggy, so it might come from this. I’m looking for a 3ds max DAE exporter compatible with 3ds max 2013, as OpenCOLLADA is only compatible up to 2011.

Oh,the version problem.
By the way do you know how to Reference one daeElement (e.g.<node>) from other .dae document ?

Huh… Just keep the element’s id/name, then open your other .dae document and find it? .dae are plain xml with specific node names. If you know how to manipulate xml, you should easily find what you are looking for. :stuck_out_tongue:

We had the same problem here (all polygons of the model were included in all material subsets).
Turned out that this was a bug in the Autodesk FBX Collada Exporter.
It has been fixed with the version 2013.2 (see the release notes http://area.autodesk.com/forum/autodesk-fbx/fbx-sdk/fbx-20132-now-available).