Hi all!
I’m currently working on my graduation project and am in need of a 3D game engine that works well with Python. After trying OpenSceneGraph’s Python bindings (which were cumbersome to compile and setup) I was happy to find Panda3D.
For my project I need to display a bunch of geometries saved in Collada. I use pycollada to generate the .dae files and feed those to dae2egg. The problem is that I can’t get the .egg’s to display in Panda3D either through code or through pview. This is the collada file for a simple untextured cube:
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<created>2011-12-13T16:31:21.890130</created>
<modified>2011-12-13T16:31:21.890136</modified>
<up_axis>Y_UP</up_axis>
</asset>
<library_effects>
<effect name="effect0" id="effect0">
<profile_COMMON>
<technique sid="common">
<phong>
<emission>
<color>0.0 0.0 0.0 1.0</color>
</emission>
<ambient>
<color>0.0 0.0 0.0 1.0</color>
</ambient>
<diffuse>
<color>1 0 0 1.0</color>
</diffuse>
<specular>
<color>0 1 0 1.0</color>
</specular>
<shininess>
<float>0.0</float>
</shininess>
<reflective>
<color>0.0 0.0 0.0 1.0</color>
</reflective>
<reflectivity>
<float>0.0</float>
</reflectivity>
<transparent>
<color>0.0 0.0 0.0 1.0</color>
</transparent>
<transparency>
<float>0.0</float>
</transparency>
</phong>
</technique>
<extra>
<technique profile="GOOGLEEARTH">
<double_sided>0</double_sided>
</technique>
</extra>
</profile_COMMON>
</effect>
</library_effects>
<library_geometries>
<geometry id="geometry0" name="mycube">
<mesh>
<source id="cubenormals-array">
<float_array count="72" id="cubenormals-array-array">0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1</float_array>
<technique_common>
<accessor count="24" source="#cubenormals-array-array" stride="3">
<param type="float" name="X"/>
<param type="float" name="Y"/>
<param type="float" name="Z"/>
</accessor>
</technique_common>
</source>
<source id="cubeverts-array">
<float_array count="24" id="cubeverts-array-array">-50 50 50 50 50 50 -50 -50 50 50 -50 50 -50 50 -50 50 50 -50 -50 -50 -50 50 -50 -50</float_array>
<technique_common>
<accessor count="8" source="#cubeverts-array-array" stride="3">
<param type="float" name="X"/>
<param type="float" name="Y"/>
<param type="float" name="Z"/>
</accessor>
</technique_common>
</source>
<vertices id="cubeverts-array-vertices">
<input source="#cubeverts-array" semantic="POSITION"/>
</vertices>
<triangles count="12" material="materialref">
<input source="#cubenormals-array" semantic="NORMAL" offset="1"/>
<input source="#cubeverts-array-vertices" semantic="VERTEX" offset="0"/>
<p>0 0 2 1 3 2 0 0 3 2 1 3 0 4 1 5 5 6 0 4 5 6 4 7 6 8 7 9 3 10 6 8 3 10 2 11 0 12 4 13 6 14 0 12 6 14 2 15 3 16 7 17 5 18 3 16 5 18 1 19 5 20 7 21 6 22 5 20 6 22 4 23</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_materials>
<material name="mymaterial" id="material0">
<instance_effect url="#effect0"/>
</material>
</library_materials>
<library_visual_scenes>
<visual_scene id="myscene">
<node name="node0" id="node0">
<instance_geometry url="#geometry0">
<bind_material>
<technique_common>
<instance_material symbol="materialref" target="#material0"/>
</technique_common>
</bind_material>
</instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#myscene"/>
</scene>
</COLLADA>
Feeding this into dae2egg produces this egg
<CoordinateSystem> { Y-Up }
<Comment> {
"dae2egg test.dae"
}
<Material> materialref {
<Scalar> diffr { 1 }
<Scalar> diffg { 0 }
<Scalar> diffb { 0 }
<Scalar> ambr { 0 }
<Scalar> ambg { 0 }
<Scalar> ambb { 0 }
<Scalar> emitr { 0 }
<Scalar> emitg { 0 }
<Scalar> emitb { 0 }
<Scalar> specr { 0 }
<Scalar> specg { 1 }
<Scalar> specb { 0 }
<Scalar> shininess { 0 }
}
<Group> node0 {
<Group> geometry0 {
<Scalar> blend { add }
<Scalar> blendop-a { zero }
<Scalar> blendop-b { one }
<Scalar> blendr { 0 }
<Scalar> blendg { 0 }
<Scalar> blendb { 0 }
<Scalar> blenda { 0 }
<VertexPool> geometry0 {
<Vertex> 0 {
-50 50 50
<Normal> { 0 0 1 }
}
<Vertex> 1 {
-50 -50 50
<Normal> { 0 0 1 }
}
<Vertex> 2 {
50 -50 50
<Normal> { 0 0 1 }
}
<Vertex> 3 {
-50 50 50
<Normal> { 0 0 1 }
}
<Vertex> 4 {
50 -50 50
<Normal> { 0 0 1 }
}
<Vertex> 5 {
50 50 50
<Normal> { 0 0 1 }
}
<Vertex> 6 {
-50 50 50
<Normal> { 0 1 0 }
}
<Vertex> 7 {
50 50 50
<Normal> { 0 1 0 }
}
<Vertex> 8 {
50 50 -50
<Normal> { 0 1 0 }
}
<Vertex> 9 {
-50 50 50
<Normal> { 0 1 0 }
}
<Vertex> 10 {
50 50 -50
<Normal> { 0 1 0 }
}
<Vertex> 11 {
-50 50 -50
<Normal> { 0 1 0 }
}
<Vertex> 12 {
-50 -50 -50
<Normal> { 0 -1 0 }
}
<Vertex> 13 {
50 -50 -50
<Normal> { 0 -1 0 }
}
<Vertex> 14 {
50 -50 50
<Normal> { 0 -1 0 }
}
<Vertex> 15 {
-50 -50 -50
<Normal> { 0 -1 0 }
}
<Vertex> 16 {
50 -50 50
<Normal> { 0 -1 0 }
}
<Vertex> 17 {
-50 -50 50
<Normal> { 0 -1 0 }
}
<Vertex> 18 {
-50 50 50
<Normal> { -1 0 0 }
}
<Vertex> 19 {
-50 50 -50
<Normal> { -1 0 0 }
}
<Vertex> 20 {
-50 -50 -50
<Normal> { -1 0 0 }
}
<Vertex> 21 {
-50 50 50
<Normal> { -1 0 0 }
}
<Vertex> 22 {
-50 -50 -50
<Normal> { -1 0 0 }
}
<Vertex> 23 {
-50 -50 50
<Normal> { -1 0 0 }
}
<Vertex> 24 {
50 -50 50
<Normal> { 1 0 0 }
}
<Vertex> 25 {
50 -50 -50
<Normal> { 1 0 0 }
}
<Vertex> 26 {
50 50 -50
<Normal> { 1 0 0 }
}
<Vertex> 27 {
50 -50 50
<Normal> { 1 0 0 }
}
<Vertex> 28 {
50 50 -50
<Normal> { 1 0 0 }
}
<Vertex> 29 {
50 50 50
<Normal> { 1 0 0 }
}
<Vertex> 30 {
50 50 -50
<Normal> { 0 0 -1 }
}
<Vertex> 31 {
50 -50 -50
<Normal> { 0 0 -1 }
}
<Vertex> 32 {
-50 -50 -50
<Normal> { 0 0 -1 }
}
<Vertex> 33 {
50 50 -50
<Normal> { 0 0 -1 }
}
<Vertex> 34 {
-50 -50 -50
<Normal> { 0 0 -1 }
}
<Vertex> 35 {
-50 50 -50
<Normal> { 0 0 -1 }
}
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 0 1 2 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 3 4 5 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 6 7 8 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 9 10 11 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 12 13 14 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 15 16 17 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 18 19 20 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 21 22 23 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 24 25 26 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 27 28 29 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 30 31 32 <Ref> { geometry0 } }
}
<Polygon> {
<MRef> { materialref }
<VertexRef> { 33 34 35 <Ref> { geometry0 } }
}
}
}
<Table> {
}
which, when loaded in pview, does not show up. I’ve tried turning on the lights, showing the wireframe, centering the object, displaying the bbox, etc. but nothing seems to work.
I also tried to tweak the model into view with the GUI by calling the .place() function on the model, but to no avail.
Any thoughts on what might be going wrong? Is there a minimum amount of information needed in an .egg file in order to get it to render?
Thanks in advance,
Simeon