tools to analyze dae files

Hi!

I want to write a collada exporter and I’ve run into problems. My exported file couldn’t be loaded. I tried the viewer app shipped with collada dom and with GLC-player. viewer crashed, while GLC-player says ‘file is corrupted’ at opening. I tried the coherencytest application and it can’t find any problem.
Do you suggest any other tools that can tell me where is the problem with that file?

The generated collada file from my program (for a simple cube):


<?xml version="1.0" ?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
    <asset>
        <contributor>
            <authoring_tool>LeoWorld</authoring_tool>
        </contributor>
        <created>2009-10-06T06:38:06Z</created>
        <modified>2009-10-06T06:38:06Z</modified>
        <up_axis>Y_UP</up_axis>
    </asset>
    <library_effects>
        <effect id="LeoStandard">
            <profile_COMMON>
                <newparam sid="mat_ambient">
                    <float3>0 0 0</float3>
                </newparam>
                <newparam sid="mat_diffuse">
                    <float3>0.6 0.6 0.6</float3>
                </newparam>
                <newparam sid="mat_specular">
                    <float3>0.3 0.3 0.3</float3>
                </newparam>
                <newparam sid="mat_shininess">
                    <float>1.0</float>
                </newparam>
                <newparam sid="mat_opacity">
                    <float>1.0</float>
                </newparam>
                <technique sid="common">
                    <blinn>
                        <ambient>
                            <param ref="mat_ambient" />
                        </ambient>
                        <diffuse>
                            <param ref="mat_diffuse" />
                        </diffuse>
                        <specular>
                            <param ref="mat_specular" />
                        </specular>
                        <shininess>
                            <param ref="mat_shininess" />
                        </shininess>
                    </blinn>
                </technique>
            </profile_COMMON>
        </effect>
    </library_effects>
    <library_materials>
        <material id="mesh0_material0">
            <instance_effect url="#LeoStandard">
                <setparam ref="mat_ambient">
                    <float3>1 0.5 0.3</float3>
                </setparam>
                <setparam ref="mat_diffuse">
                    <float3>1 0.5 0.3</float3>
                </setparam>
                <setparam ref="mat_specular">
                    <float3>0.65 0.65 0.65</float3>
                </setparam>
                <setparam ref="mat_shininess">
                    <float>3</float>
                </setparam>
                <setparam ref="mat_opacity">
                    <float>1</float>
                </setparam>
            </instance_effect>
        </material>
    </library_materials>
    <library_geometries>
        <geometry id="mesh0_geometry">
            <mesh>
                <source id="mesh0_position_source">
                    <float_array id="mesh0_position_array" count="24">0 -0.388405740261078 -0.519999980926514 0 -0.388405740261078 0 0 0 -0.519999980926514 0 0 0 0.41481414437294 -0.388405740261078 0 0.41481414437294 -0.388405740261078 -0.519999980926514 0.41481414437294 0 -0.519999980926514 0.41481414437294 0 0 </float_array>
                    <technique_common>
                        <accessor source="#mesh0_position_array" count="8" stride="3">
                            <param name="pos_x" type="float" />
                            <param name="pos_y" type="float" />
                            <param name="pos_z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="mesh0_packet0_attribute_source">
                    <float_array id="mesh0_packet0_attribute_array" count="24">-0.600088022007413 -0.640889084775454 -0.478701939476865 -0.659424112528642 -0.704259542697766 0.263017749087293 -0.721404575441165 0.385227084320642 -0.575478524393717 -0.351194010323603 0.750144644120676 0.56030864709541 0.721404575441165 -0.385227084320642 0.575478524393717 0.351194010323603 -0.750144644120676 -0.56030864709541 0.659424112528642 0.704259542697766 -0.263017749087293 0.600088022007413 0.640889084775454 0.478701939476865 </float_array>
                </source>
                <source id="mesh0_packet0_NORMAL_source">
                    <technique_common>
                        <accessor source="#mesh0_packet0_attribute_array" count="8" stride="3" offset="0">
                            <param name="NORMAL_x" type="float" />
                            <param name="NORMAL_y" type="float" />
                            <param name="NORMAL_z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="mesh0_vertices">
                    <input semantic="POSITION" source="#mesh0_position_source" />
                </vertices>
                <triangles name="mesh0_packet0_material0_triangles" count="12" material="mesh0_material0">
                    <input semantic="VERTEX" source="#mesh0_vertices" offset="0" />
                    <input semantic="NORMAL" source="#mesh0_packet0_NORMAL_source" offset="1" />
                    

0 0 1 1 2 2 2 2 1 1 3 3 4 4 5 5 6 6 4 4 6 6 7 7 1 1 0 0 5 5 5 5 4 4 1 1 2 2 3 3 6 6 7 7 6 6 3 3 0 0 2 2 5 5 5 5 2 2 6 6 3 3 1 1 4 4 3 3 4 4 7 7 </p>
                </triangles>
            </mesh>
        </geometry>
    </library_geometries>
    <library_visual_scenes>
        <visual_scene id="mesh0_scene">
            <node>
                <instance_geometry url="#mesh0_geometry">
                    <bind_material>
                        <technique_common>
                            <instance_material symbol="mesh0_material0" target="#mesh0_material0" />
                        </technique_common>
                    </bind_material>
                </instance_geometry>
            </node>
        </visual_scene>
    </library_visual_scenes>
    <scene>
        <instance_visual_scene url="#mesh0_scene" />
    </scene>
    <extra>
        <technique profile="leo">
            <type>mesh</type>
        </technique>
    </extra>
</COLLADA>


I tried this without any effects and materials, still doesn’t work.
Thanks for any help.

kend

I’ve run the viewer in debug mode and it crashed when reading the <input>s of the <triangles> element in the CrtOffsets::SetInputs function.

CrtSceneRead.cpp line 678:
normal_floats = & source->getFloat_array()->getValue();

Here, the source have no float_array. This is becouse I designed my file in a manner that all vertex attributes (excluding position, in this case only normal) are stored in one interleaved attribute array, and different sources with specific accessors reference to it. This is legal according to the COLLADA specification.

Have I missed something or is this a bug in the COLLADA_RT library?

As a workaround I try to store a source with an array for each vertex attribute.

kend

What you’re doing sounds fine but that sample program doesn’t handle sophisticated content.

Hello, and sorry for the delay. :?

Marcus is right, you are using sophisticated content that GLC_Player can’t handle. :oops:
The problem come from the <instance_effect> optional element : <setparam> which is not handle by GLC_Player.

In the provided file, this Collada feature is not mandatory, normally this optional element is used when you need to use the same material with differents properties. Then If you want a better support to your Collada files I recommend you to not use this optional feature unless you need it . :wink:

Regards.