Horde3D

Next-Generation Graphics Engine
It is currently 26.11.2024, 03:14

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 02.07.2008, 22:26 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
It seems ColladaConv (and the engine?) can't handle geometry objects with multiple materials, for example:

Code:
   <geometry id="Building01-mesh" name="Building01">
      <mesh>
        <source id="Building01-mesh-positions">
          <float_array id="Building01-mesh-positions-array" count="19476"> ... </float_array>
          <technique_common>
            <accessor source="#Building01-mesh-positions-array" count="6492" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Building01-mesh-normals">
          <float_array id="Building01-mesh-normals-array" count="84711"> ... </float_array>
     <technique_common>
            <accessor source="#Building01-mesh-normals-array" count="28237" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Building01-mesh-map-channel1">
          <float_array id="Building01-mesh-map-channel1-array" count="22242"> ... </float_array>
     <technique_common>
            <accessor source="#Building01-mesh-map-channel1-array" count="7414" stride="3">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
              <param name="P" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="Building01-mesh-vertices">
          <input semantic="POSITION" source="#Building01-mesh-positions"/>
        </vertices>
        <triangles material="Building01_Material" count="4520">
          <input semantic="VERTEX" source="#Building01-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Building01-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Building01-mesh-map-channel1" offset="2" set="1"/>
          <p> ... </p>
   </triangles>
        <triangles material="BuildingInner_Material" count="6661">
          <input semantic="VERTEX" source="#Building01-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Building01-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Building01-mesh-map-channel1" offset="2" set="1"/>
          <p> ... </p>
   </triangles>
        <triangles material="Concrete_Material3" count="764">
          <input semantic="VERTEX" source="#Building01-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Building01-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Building01-mesh-map-channel1" offset="2" set="1"/>
          <p> ... </p>
   </triangles>
        <triangles material="Glass_Material" count="132">
          <input semantic="VERTEX" source="#Building01-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Building01-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Building01-mesh-map-channel1" offset="2" set="1"/>
          <p> ... </p>
   </triangles>
      </mesh>
    </geometry>


ColladaConv produces weird XML converting this:

Code:
   <Mesh name="Building01_PIVOT" material="LevelAssembly/Building01_Material.material.xml" tx="-40.465" ty="1.00136e-005" tz="-49.6911" batchStart="835095" batchCount="13548" vertRStart="351651" vertREnd="359047">
      <Mesh name="Building01_PIVOT" material="LevelAssembly/BuildingInner_Material.material.xml" batchStart="848643" batchCount="19983" vertRStart="359048" vertREnd="369040" />
      <Mesh name="Building01_PIVOT" material="LevelAssembly/Concrete_Material3.material.xml" batchStart="868626" batchCount="2280" vertRStart="369041" vertREnd="371276" />
      <Mesh name="Building01_PIVOT" material="LevelAssembly/Glass_Material.material.xml" batchStart="870906" batchCount="396" vertRStart="371277" vertREnd="371540" />
   </Mesh>
 />
 />


Is this unsupported?


Top
 Profile  
Reply with quote  
PostPosted: 03.07.2008, 12:54 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
Looks like a bug. Is it possible that you could post the collada file which causes this?

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 07.07.2008, 15:05 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
OK, I have isolated the problem, and it does seem to be a bug in our converter. Your model contains a couple of nodes with splines attached ('StairAngle' and 'StairAngle01'). Horde doesn't render splines, so the splines themselves are discarded by the converter, but the node itself is not, and thus writes out its closing tag.

You can safely delete the 2 unmatched closing tags from the output, and all should work fine.

@marciano, volker: The problem is that the converter processes all nodes, writing closing tags for all of them, but it only writes an opening tag if they are a joint or a mesh. I don't know of a quick fix for this, but we do need to either output empty nodes, or ignore nodes we don't understand.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 08.07.2008, 14:37 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
@jimbo

can you check if the following patch solves the problem?
Code:
Index: converter.cpp
===================================================================
--- converter.cpp   (revision 619)
+++ converter.cpp   (working copy)
@@ -999,11 +999,21 @@
 
    if( node->children.size() == 0 )
    {
-      if( !node->typeJoint && ((Mesh *)node)->triGroups.size() > 1 )
+      if( !node->typeJoint )
       {
-         for( unsigned int j = 0; j < depth + 1; ++j ) outf << "\t";
-         outf << "</Mesh>\n";
-      }
+         switch( ((Mesh *)node)->triGroups.size() )
+         {
+         case 0:
+            break; // Don't close node because there was no open tag when no trigroup exists
+         case 1:
+            outf << " />\n";
+            break;
+         default:
+            for( unsigned int j = 0; j < depth + 1; ++j ) outf << "\t";
+            outf << "</Mesh>\n";   
+            break;
+         }
+      }               
       else
       {
          outf << " />\n";


@swiftcoder Thanks for investigating the problem


Top
 Profile  
Reply with quote  
PostPosted: 08.07.2008, 19:39 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
Yes this works excellent thanks!


Top
 Profile  
Reply with quote  
PostPosted: 08.07.2008, 21:31 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
@Volker and swiftcoder: Thanks a lot for investigating and fixing that issue!

Did ColladaConv output a warning that some geometry (the splines) is not supported?


Top
 Profile  
Reply with quote  
PostPosted: 08.07.2008, 23:59 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
marciano wrote:
Did ColladaConv output a warning that some geometry (the splines) is not supported?
Yes, but it then proceeded to print the closing tags regardless :)

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 09.07.2008, 07:39 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Fixed it in the SVN. Thanks guys for the support!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group