Assistance required troubleshooting my DAE export.

I have written a C++ application using the COLLADA-dom to export models into dae. At eye value it looks very correct. I have gone over the syntax many times, double checked against examples and ran through the COLLADA coherencytest which returned no errors (after I had fixed the ones it did find).

I have attached the export below, its very small and just contains the geometries.

The 3Ds MAX importer will crash when importing without any indication of where the parser crashed. The Blender importer will give the error in the console: ValueError: invalid literal for float(): 52-08

I really am stumped here, I wouldn’t post here without exhausting my own attempts. Thanks in advance! COLLADA will give me a real advantage in my project once I get it going.

Peace, Maeyan

Your mesh has 200 triangles.
That means you have 200 * 3 = 600 sets of point data.
For each set of point data, you have 1 index for vertex position, 1 index of normals, 1 index for texcoords.

That means you should have 600 * 3 =1800 indices in your

</p>, but you only have 1200 index in your

Check if you export the index of your position, normal, and texcoord correctly in that order.

I am surprise that the coherencytest couldn’t catch that, may I have the full version of the dae file you ran against coherencytest.

Herbert

I did have trouble understanding those tags. The specification documentation isn’t as clear as your explanation, thank you! Actually the dae I attached is the one I ran through the coherencytest. I will keep posted, cheers.

EDIT: I used the latest version of coherencytest from Sourceforge.

I ran it against the new coherencytest_win32_x86.exe here
http://sourceforge.net/project/showfile … _id=229663
It caught 3 problems.

  1. semantic=“POSTION” is spelled wrong.
  2. the count of

is not match
3. some of the indices value in

is greater than 239, the max value you can index in <source>

Herbert

How embarrassing. I realize now I didn’t use the coherencytest properly. :oops:

Thanks again for your great help.

Below is how I cast the mesh index in OGRE xml format but I don’t understand how I would cast this in COLLADA. I don’t suppose you could help me one more time? :slight_smile:

<mesh>
    <submeshes>
        <submesh material="agitator_mesh" usesharedvertices="false" use32bitindexes="false" operationtype="triangle_list">
            <faces count="200">
                <face v1="129" v2="104" v3="103" />
                <face v1="103" v2="100" v3="127" />
 ....
                <face v1="0" v2="6" v3="1" />
                <face v1="1" v2="15" v3="0" />
                <face v1="8" v2="29" v3="19" />
            </faces>
            <geometry vertexcount="239">
                <vertexbuffer positions="true" normals="true" texture_coord_dimensions_0="2" texture_coords="1">
                    <vertex>
                        <position x="0.031929" y="-0.4131" z="0.214812" />
                        <normal x="0.703114" y="-0.24763" z="0.666566" />
                        <texcoord u="0.513141" v="0.217319" />
                    </vertex>
                    <vertex>
                        <position x="0.0304611" y="-0.237615" z="0.231583" />
                        <normal x="0.479395" y="0.342587" z="0.807969" />
                        <texcoord u="0.245871" v="0.350954" />
                    </vertex>
etc etc....

EDIT: I removed most of the body from the example above for convenience. :wink:

You can represent this mesh in many different ways, the most traditional way is


<geometry>
  <mesh>
    <source id="position_id"> 
       <float_array id="position_array_id" count="717"> 0.031929 -0.4131 0.214812   0.0304611 -0.237615 0.231583 ..... </float_array> ... </source>
    <source id="normal_id"> 
       <float_array id="normal_array_id" count="717"> 0.703114 -0.24763 0.666566   0.479395 0.342587 0.807969..... </float_array>  ... </source>
    <source id="texcoord_id"> 
       <float_array id="texcoord_array_id" count="478"> 0.513141 0.217319   0.245871 0.350954 ..... </float_array> .... </source>
    <vertices id="vertices_id">
      <input semantic="POSITION" source="#position_id"/>
    </vertices>
    <triangles count="200">
      <input semantic="VERTEX" source="#vertices_id" offset="0"/>
      <input semantic="NORMAL" source="#normal_id" offset="1"/>
      <input semantic="TEXCOORD" source="#texcoord_id" offset="2"/>
      

129 129 129 104 104 104 103 103 103                                    
             103 103 103 100 100 100 127 127 127 ... </p>
   </triangles>
  </mesh>
</geometry>

You can optimize the document by replacing the and with the following


    <vertices id="vertices_id">
      <input semantic="POSITION" source="#position_id"/>
      <input semantic="NORMAL" source="#normal_id"/>
      <input semantic="TEXCOORD" source="#texcoord_id"/>
    </vertices>
    <triangles count="200">
      <input semantic="VERTEX" source="#vertices_id" offset="0"/>
      

129 104 103
             103 100 127 ... </p>
   </triangles>

Both versions are valid and represent the same mesh.

Herbert

The import now works correctly and I clearly understand how it works thanks to your thorough advice. Again, thank you so much. I’m so grateful.

Ok, so both meshes represent the same geometry, but isn’t there a difference when using these meshes for morphing?

If I understand correctly the first mesh will only blend positions and the second mesh will blend positions, normals and texcoords.

Roland

Yes Roland is correct.
The two meshes means different when it comes to morphing.
Morphing only morphs everything you put in <vertices>.

Herbert

I have another related issue.

I’m exporting a model that had 5 index buffers, 1 position array, 1 uv array and 1 normals array. (at least this is how it appears).

How do I go about hooking up 5 index buffers? I couldn’t find any examples

Thanks again in advance.

EDIT: I have encountered some #QNAN numbers in my float arrays, namely the normals. An example of one of these in hex: 0x63 7F FB FF

  • What advice can you offer me here? :?:

You can certainly use more than 3 index buffers.
Beside Position, Normal, and Texcoord, you might want to export other information like Vertex Color, Tangent, BiNormal, etc.
Find out more detail description of your other 2 index buffers.

Each index buffer is describe in the <input> element with semantic like below example.


      <input semantic="POSITION" source="#position_id"/>
      <input semantic="NORMAL" source="#normal_id"/>
      <input semantic="TEXCOORD" source="#texcoord_id"/>
      <input semantic="COLOR" source="#vertex_color_id"/>
      <input semantic="TANGENT" source="#tangent_id"/>
      <input semantic="BINORMAL" source="#binormal_id"/>

Each vertex will now have 6 indices, and your will look like this


      <triangles>
       1 2 3 4 5 6    11 12 13 14 15 16    21 22 23 24 25 26     // first triangle.
       ...                                                                         // next triangle.
      </triangles>

Herbert