Textured Models, blender -> dae2egg/ x2egg -> panda??

Hello out there,

I have been trying desperately to get my textured models from blender into panda. I can get the model converted into a .egg file and into panda but without the texture. I am wondering if there is anything special that I need to do, or if there is a better way to do this?

The procedure I use is this(simplified):

  1. Use default cube.
  2. Open second viewing screen and change it to the UV/image viewer.
  3. Create new image in UV/image viewer.
  4. In object editor view, select cube object, switch to edit mode and select all vertices with ‘a’ key.
  5. Select mesh menu, click UV Unwrap > UV Smart Project.
  6. Check the image painting to allow for painting directly onto the image.
  7. start painting, finish painting, save image to desktop.
  8. Use either of the built in exporters (Collada or .x exporter) to export to desktop.
  9. on desktop open cmd navigate to desktop in cmd.
  10. type: (dae2egg or x2egg) inputfilename.(x dae) -o outputfilename.egg.
  11. type: pview filename.egg
  12. views but without texture.

If this makes sense congrats, else tell me and I’ll try to do better. Again is this wrong? Is there a better way? Is there any option in blender that I need to click / type? Help!?

There is a good chance the path to the texture in the EGG file is not correct (or not what you expected). You can open it up in a text editor and look for the “Texture” entry. It will look similar to this:

<Texture> name_of_texture {
  path/to/texture/filename.ext
}

If there is no path and just the filename, then Panda is expecting the texture file to be in the same directory as the EGG file. If there is a path before the filename then Panda will look for the texture in that directory.

Another possibility is that the UVs are not getting into the EGG file. This will show up in the EGG file in the “Vertex” entries as either a missing “UV” section or UVs all zeroes.

You might also have better luck exporting an EGG directly from Blender using the Chicken exporter.

Thanks for responding, and you were correct that I was missing the “texture” entry. Unfortunately, after adding this manually it still does not work. I tried to add both with and without path placing the .png and/or a .jpg texture to path which was also in the same directory as the .EGG file.

The UVs however are not zero and do exist. I am using another .EGG file that does have texture as a road map to editing my .EGG file. In the example .EGG file the “UV” entries in the “vertices” entries are different from my .EGG file.
My .EGG:

<UV> UVTex { 0.332314 0 }

Example .EGG:

<UV> { 1 0 }

In between the “” and the values there is UVTex in mine and not in the Example EGG. If this means something then could someone elaborate. If not let me know and I’ll let it go.

As for the Chicken idea, although it is a good idea I cannot use it because it does not work with blender 2.5x. I am aware that I could use this now but I am also trying to get this to work for future generations of a Summer Camp I am a part of. I could just use Chicken to get it to work and leave the headache for the next guy but I’d rather just get it working with these tools now. Until Chicken is working or a substitute comes along I think I am going to have to go with the COLLADA/X work around.

[/code]

Ah, yes if the Texture entry is missing then adding it manually will not work because it also has to be assigned to each Polygon. You will not want to be doing that manually since usually there are a lot of polygons.

We need to find where the Texture is being lost in your pipeline. I’m not familiar with the syntax of Collada and X but if you open then up you should be able to search for your texture and see if it is in there. Then we can at least know if it is exporting from Blender without the texture or if the texture is being lost in the conversion to EGG. If you like, export something simple like a cube and post the contents, and I will take a look.

UVs in the EGG file can be named or unnamed, so the “UVTex” is just the name given to the UVs. This is probably OK.

There is a very new exporter being worked on for Blender 2.5, see here: [url]Yet Another Blender Egg Exporter (YABEE)], though I don’t know if it will suit your needs or not yet.

Make sure that, in the texture specification in Blender, the mapping type is set to “UV” (and pointing to the right set) rather than the default “Orco”.

@teedee
You are right adding the texture to the polygons manually would not be fun at all.

I appreciate you taking a look at this, this would be very helpful.

“UVTex” is ok? OK! good to know.

Yes I have found this before and will try it out as soon as I can. I’ll report back when I can.

@rdb
Texture specification? Where is that? I will try to find that and see if that works. Thanks for the help.

Here are the files that you asked for thanks for taking the time to help.
dae file(COLLADA):

<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor>
      <author>Blender User</author>
      <authoring_tool>Blender 2.57.1 r36339</authoring_tool>
    </contributor>
    <created>2011-06-22T15:33:48</created>
    <modified>2011-06-22T15:33:48</modified>
    <unit name="meter" meter="1"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_cameras>
    <camera id="Camera-camera" name="Camera">
      <optics>
        <technique_common>
          <perspective>
            <xfov>49.13434</xfov>
            <aspect_ratio>1.777778</aspect_ratio>
            <znear>0.1</znear>
            <zfar>100</zfar>
          </perspective>
        </technique_common>
      </optics>
    </camera>
  </library_cameras>
  <library_lights>
    <light id="Lamp-light" name="Lamp">
      <technique_common>
        <point>
          <color>1 1 1</color>
          <constant_attenuation>1</constant_attenuation>
          <linear_attenuation>0</linear_attenuation>
          <quadratic_attenuation>0.06666666</quadratic_attenuation>
        </point>
      </technique_common>
      <extra>
        <technique profile="blender">
          <adapt_thresh>0.000999987</adapt_thresh>
          <area_shape>0</area_shape>
          <area_size>1</area_size>
          <area_sizey>1</area_sizey>
          <area_sizez>1</area_sizez>
          <atm_distance_factor>1</atm_distance_factor>
          <atm_extinction_factor>1</atm_extinction_factor>
          <atm_turbidity>2</atm_turbidity>
          <att1>0</att1>
          <att2>1</att2>
          <backscattered_light>1</backscattered_light>
          <bias>1</bias>
          <blue>1</blue>
          <buffers>1</buffers>
          <bufflag>0</bufflag>
          <bufsize>2880</bufsize>
          <buftype>2</buftype>
          <clipend>30.002</clipend>
          <clipsta>1.000799</clipsta>
          <compressthresh>0.04999995</compressthresh>
          <dist>29.99998</dist>
          <energy>1</energy>
          <falloff_type>2</falloff_type>
          <filtertype>0</filtertype>
          <flag>0</flag>
          <gamma>1</gamma>
          <green>1</green>
          <halo_intensity>1</halo_intensity>
          <horizon_brightness>1</horizon_brightness>
          <mode>8192</mode>
          <ray_samp>1</ray_samp>
          <ray_samp_method>1</ray_samp_method>
          <ray_samp_type>0</ray_samp_type>
          <ray_sampy>1</ray_sampy>
          <ray_sampz>1</ray_sampz>
          <red>1</red>
          <samp>3</samp>
          <shadhalostep>0</shadhalostep>
          <shadow_b>0</shadow_b>
          <shadow_g>0</shadow_g>
          <shadow_r>0</shadow_r>
          <shadspotsize>45</shadspotsize>
          <sky_colorspace>0</sky_colorspace>
          <sky_exposure>1</sky_exposure>
          <skyblendfac>1</skyblendfac>
          <skyblendtype>1</skyblendtype>
          <soft>3</soft>
          <spotblend>0.15</spotblend>
          <spotsize>75</spotsize>
          <spread>1</spread>
          <sun_brightness>1</sun_brightness>
          <sun_effect_type>0</sun_effect_type>
          <sun_intensity>1</sun_intensity>
          <sun_size>1</sun_size>
          <type>0</type>
        </technique>
      </extra>
    </light>
  </library_lights>
  <library_effects>
    <effect id="Material-effect">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <emission>
              <color>0 0 0 1</color>
            </emission>
            <ambient>
              <color>0 0 0 1</color>
            </ambient>
            <diffuse>
              <color>0.64 0.64 0.64 1</color>
            </diffuse>
            <specular>
              <color>0.5 0.5 0.5 1</color>
            </specular>
            <shininess>
              <float>50</float>
            </shininess>
            <index_of_refraction>
              <float>1</float>
            </index_of_refraction>
          </phong>
        </technique>
        <extra>
          <technique profile="GOOGLEEARTH">
            <double_sided>1</double_sided>
          </technique>
        </extra>
      </profile_COMMON>
      <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
    </effect>
  </library_effects>
  <library_materials>
    <material id="Material-material" name="Material">
      <instance_effect url="#Material-effect"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="Cube-mesh">
      <mesh>
        <source id="Cube-mesh-positions">
          <float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-positions-array" count="8" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Cube-mesh-normals">
          <float_array id="Cube-mesh-normals-array" count="18">0 0 -1 0 0 1 1 -2.83122e-7 0 -2.83122e-7 -1 0 -1 2.23517e-7 -1.3411e-7 2.38419e-7 1 2.08616e-7</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-normals-array" count="6" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Cube-mesh-map-0">
          <float_array id="Cube-mesh-map-0-array" count="48">0.3323138 0 0.3333334 0.3323139 0.001019418 0.3333334 0 0.001019418 0.3343528 0.3333334 0.6666667 0.3343529 0.6656473 0.6666668 0.3333334 0.6656473 0.3343529 0 0.6666667 0.001019537 0.6656473 0.3333334 0.3333334 0.3323139 0.9989806 0.3333334 0.9999999 0.001019597 0.6676861 0 0.6666667 0.332314 0.332314 0.6666668 0.3333334 0.3343529 0.001019537 0.3333334 0 0.6656473 0.6676862 0.3333334 1 0.3343529 0.9989805 0.6666668 0.6666667 0.6656474</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-map-0-array" count="24" stride="2">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="Cube-mesh-vertices">
          <input semantic="POSITION" source="#Cube-mesh-positions"/>
        </vertices>
        <polylist material="Material1" count="6">
          <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
          <vcount>4 4 4 4 4 4 </vcount>
          <p>0 0 0 1 0 1 2 0 2 3 0 3 4 1 4 7 1 5 6 1 6 5 1 7 0 2 8 4 2 9 5 2 10 1 2 11 1 3 12 5 3 13 6 3 14 2 3 15 2 4 16 6 4 17 7 4 18 3 4 19 4 5 20 0 5 21 3 5 22 7 5 23</p>
        </polylist>
      </mesh>
      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="Scene" name="Scene">
      <node id="Cube" type="NODE">
        <translate sid="location">0 0 0</translate>
        <rotate sid="rotationZ">0 0 1 0</rotate>
        <rotate sid="rotationY">0 1 0 0</rotate>
        <rotate sid="rotationX">1 0 0 0</rotate>
        <scale sid="scale">1 1 1</scale>
        <instance_geometry url="#Cube-mesh">
          <bind_material>
            <technique_common>
              <instance_material symbol="Material1" target="#Material-material">
                <bind_vertex_input semantic="UVTex" input_semantic="TEXCOORD" input_set="0"/>
              </instance_material>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
      <node id="Lamp" type="NODE">
        <translate sid="location">4.076245 1.005454 5.903862</translate>
        <rotate sid="rotationZ">0 0 1 106.9363</rotate>
        <rotate sid="rotationY">0 1 0 3.163707</rotate>
        <rotate sid="rotationX">1 0 0 37.26105</rotate>
        <scale sid="scale">1 1 1</scale>
        <instance_light url="#Lamp-light"/>
      </node>
      <node id="Camera" type="NODE">
        <translate sid="location">7.481132 -6.50764 5.343665</translate>
        <rotate sid="rotationZ">0 0 1 46.69194</rotate>
        <rotate sid="rotationY">0 1 0 0.6197679</rotate>
        <rotate sid="rotationX">1 0 0 63.55929</rotate>
        <scale sid="scale">1 1 1</scale>
        <instance_camera url="#Camera-camera"/>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#Scene"/>
  </scene>
</COLLADA>

EGG file:

<CoordinateSystem> { Z-Up }

<Comment> {
  "dae2egg cube.dae -o cube.egg"
}
<Material> Material1 {
  <Scalar> diffr { 0.64 }
  <Scalar> diffg { 0.64 }
  <Scalar> diffb { 0.64 }
  <Scalar> ambr { 0 }
  <Scalar> ambg { 0 }
  <Scalar> ambb { 0 }
  <Scalar> emitr { 0 }
  <Scalar> emitg { 0 }
  <Scalar> emitb { 0 }
  <Scalar> specr { 0.5 }
  <Scalar> specg { 0.5 }
  <Scalar> specb { 0.5 }
  <Scalar> shininess { 50 }
}
<Group> Cube {
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 0 1
    }
  }
  <Group> Cube-mesh {
    <VertexPool> Cube-mesh {
      <Vertex> 0 {
        1 1 -1
        <UV> UVTex { 0.332314 0 }
        <Normal> { 0 0 -1 }
      }
      <Vertex> 1 {
        1 -1 -1
        <UV> UVTex { 0.333333 0.332314 }
        <Normal> { 0 0 -1 }
      }
      <Vertex> 2 {
        -1 -1 -1
        <UV> UVTex { 0.00101942 0.333333 }
        <Normal> { 0 0 -1 }
      }
      <Vertex> 3 {
        -1 1 -1
        <UV> UVTex { 0 0.00101942 }
        <Normal> { 0 0 -1 }
      }
      <Vertex> 4 {
        1 1 1
        <UV> UVTex { 0.334353 0.333333 }
        <Normal> { 0 0 1 }
      }
      <Vertex> 5 {
        -1 1 1
        <UV> UVTex { 0.666667 0.334353 }
        <Normal> { 0 0 1 }
      }
      <Vertex> 6 {
        -1 -1 1
        <UV> UVTex { 0.665647 0.666667 }
        <Normal> { 0 0 1 }
      }
      <Vertex> 7 {
        0.999999 -1 1
        <UV> UVTex { 0.333333 0.665647 }
        <Normal> { 0 0 1 }
      }
      <Vertex> 8 {
        1 1 -1
        <UV> UVTex { 0.334353 0 }
        <Normal> { 1 -2.83122e-007 0 }
      }
      <Vertex> 9 {
        1 1 1
        <UV> UVTex { 0.666667 0.00101954 }
        <Normal> { 1 -2.83122e-007 0 }
      }
      <Vertex> 10 {
        0.999999 -1 1
        <UV> UVTex { 0.665647 0.333333 }
        <Normal> { 1 -2.83122e-007 0 }
      }
      <Vertex> 11 {
        1 -1 -1
        <UV> UVTex { 0.333333 0.332314 }
        <Normal> { 1 -2.83122e-007 0 }
      }
      <Vertex> 12 {
        1 -1 -1
        <UV> UVTex { 0.998981 0.333333 }
        <Normal> { -2.83122e-007 -1 0 }
      }
      <Vertex> 13 {
        0.999999 -1 1
        <UV> UVTex { 1 0.0010196 }
        <Normal> { -2.83122e-007 -1 0 }
      }
      <Vertex> 14 {
        -1 -1 1
        <UV> UVTex { 0.667686 0 }
        <Normal> { -2.83122e-007 -1 0 }
      }
      <Vertex> 15 {
        -1 -1 -1
        <UV> UVTex { 0.666667 0.332314 }
        <Normal> { -2.83122e-007 -1 0 }
      }
      <Vertex> 16 {
        -1 -1 -1
        <UV> UVTex { 0.332314 0.666667 }
        <Normal> { -1 2.23517e-007 -1.3411e-007 }
      }
      <Vertex> 17 {
        -1 -1 1
        <UV> UVTex { 0.333333 0.334353 }
        <Normal> { -1 2.23517e-007 -1.3411e-007 }
      }
      <Vertex> 18 {
        -1 1 1
        <UV> UVTex { 0.00101954 0.333333 }
        <Normal> { -1 2.23517e-007 -1.3411e-007 }
      }
      <Vertex> 19 {
        -1 1 -1
        <UV> UVTex { 0 0.665647 }
        <Normal> { -1 2.23517e-007 -1.3411e-007 }
      }
      <Vertex> 20 {
        1 1 1
        <UV> UVTex { 0.667686 0.333333 }
        <Normal> { 2.38419e-007 1 2.08616e-007 }
      }
      <Vertex> 21 {
        1 1 -1
        <UV> UVTex { 1 0.334353 }
        <Normal> { 2.38419e-007 1 2.08616e-007 }
      }
      <Vertex> 22 {
        -1 1 -1
        <UV> UVTex { 0.998981 0.666667 }
        <Normal> { 2.38419e-007 1 2.08616e-007 }
      }
      <Vertex> 23 {
        -1 1 1
        <UV> UVTex { 0.666667 0.665647 }
        <Normal> { 2.38419e-007 1 2.08616e-007 }
      }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 0 1 2 3 <Ref> { Cube-mesh } }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 4 5 6 7 <Ref> { Cube-mesh } }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 8 9 10 11 <Ref> { Cube-mesh } }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 12 13 14 15 <Ref> { Cube-mesh } }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 16 17 18 19 <Ref> { Cube-mesh } }
    }
    <Polygon> {
      <MRef> { Material1 }
      <BFace> { 1 }
      <VertexRef> { 20 21 22 23 <Ref> { Cube-mesh } }
    }
  }
}
<Group> Lamp {
  <Transform> {
    <Matrix4> {
      -0.290864 0.955171 -0.0551891 0
      -0.771101 -0.199883 0.604525 0
      0.566393 0.218391 0.794672 0
      4.07624 1.00545 5.90386 1
    }
  }
}
<Group> Camera {
  <Transform> {
    <Matrix4> {
      0.685881 0.727634 -0.0108168 0
      -0.31737 0.312469 0.895343 0
      0.654862 -0.610666 0.445245 0
      7.48113 -6.50764 5.34367 1
    }
  }
}
<Table> {
}

Sorry about this being so long, I’m new to this forum cant find the spoiler/minimize option.

I don’t see any texture in the Collada file, so there must be something you need to do in Blender in order for it to export the texture into the Collada file.

Thanks for looking at it, I didn’t see anything blatantly obvious so I ‘assumed’ that it was hidden in the file somewhere.

If its not there then does anyone know what I may be missing?

I will continue to scan the forums and welcome any help.

Have you added a material + texture + your image texture to blender model? apart from the UV.

cheers,
n3storm

thank you for the help. I’ll double check. sorry about the how long it took to reply RL just took over.