Horde3D http://horde3d.org/forums/ |
|
[solved] geometry with multiple materials http://horde3d.org/forums/viewtopic.php?f=3&t=391 |
Page 1 of 1 |
Author: | jimbo [ 02.07.2008, 22:26 ] |
Post subject: | [solved] geometry with multiple materials |
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? |
Author: | swiftcoder [ 03.07.2008, 12:54 ] |
Post subject: | Re: geometry with multiple materials |
Looks like a bug. Is it possible that you could post the collada file which causes this? |
Author: | swiftcoder [ 07.07.2008, 15:05 ] |
Post subject: | Re: geometry with multiple materials |
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. |
Author: | Volker [ 08.07.2008, 14:37 ] |
Post subject: | Re: geometry with multiple materials |
@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 |
Author: | jimbo [ 08.07.2008, 19:39 ] |
Post subject: | Re: geometry with multiple materials |
Yes this works excellent thanks! |
Author: | marciano [ 08.07.2008, 21:31 ] |
Post subject: | Re: geometry with multiple materials |
@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? |
Author: | swiftcoder [ 08.07.2008, 23:59 ] |
Post subject: | Re: geometry with multiple materials |
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
|
Author: | Volker [ 09.07.2008, 07:39 ] |
Post subject: | Re: geometry with multiple materials |
Fixed it in the SVN. Thanks guys for the support! |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |