Blender 2.6, yabee, .x, pview, x2egg: Texturing Problems

Okay so I’m basically at step one here with trying to import my own models. I can’t get textures to render. At all. Even if they’re in the file. Here’s what I’m doing:

In Blender 2.6 I’m making a plain box and giving it a texture, “woodboards.jpg”. I’m saving the file. Then I’m using the most recent yabee .egg exporter to export it to .egg. I’m also using Chris Foster’s .x exporter that comes with Blender to export to .x.

If I open the files, I find that the .x file has the texture, “TextureFilename {“woodboards.jpg”;}”, but the .egg file doesn’t. After using x2egg to convert the .x file into a .egg file, I find that the newly converted .egg file has the texture, " tref1 { woodboards.jpg }".

However, when viewing them in pview, I get problems.

First off, I can’t view them in a sensible manner. If I type “pview \box.x”, and I had already had viewed a “box.x” object in the past, I get the past box.x, not the current one. This holds true even if the old box.x object wasn’t in the same directory. That is, if I had a file at “C:\box.x” that was a dinosaur and I did “pview C:\box.x” and saw a dinosaur. Then I went to view my wood-covered box at “C:\temp\box.x” and typed “pview C:\temp\box.x”, I would see the dinosaur, not the wood box that’s actually being passed into pview. In fact, this even holds for when I delete the dinosaur named “box.x”. So in order to even so much as look at the box object, I have to rename it to a filename that pview has never seen before. Right now I’m up to box9.x just so I can look at the right fucking box. I checked everywhere and have seen no reason why pview should be doing this and I can’t find where pview is actually storing the old objects. It doesn’t make any sense.

Secondly, assuming I hack my way through pview and get it to recognize a new object, I find that it doesn’t render the texture. For the .x file straight from Blender 2.6, I get a brown box, no texture. For the .egg file generated from x2egg, I get the same brown box. For the .egg file made by yabee that lacks the texture data, I get, obviously, a white box.

Every other thread I could find was basically of the form “I can’t get textures working”, “Check in notepad if the files have the textures in them”, “oh, thanks”. In this case, the textures are there, but they’re not being rendered. The fact that pview renders the box as a general brown means that it’s accessing the .jpg file… somehow. But it’s not doing it correctly.

So my question is, even when I have the texture data in the files, how do I get it to render? Furthermore, how do I fix pview so that it shows me the object I want to see? And is there a guide to using yabee? The post hosting it doesn’t seem to have any information on how to use it. The pdf linked there, http://www.2shared.com/complete/B5sWDMcN/yabee.html, isn’t very helpful.

I feel like this is a problem a lot of people have had, hopefully the solution is one you guys might be able to help me with. Thanks in advance for whatever you can do.

Here are the entire files:

box.x straight out of Blender 2.6:

xof 0303txt 0032

Frame Root {
  FrameTransformMatrix {
     1.000000, 0.000000, 0.000000, 0.000000,
     0.000000, 0.000000, 1.000000, 0.000000,
     0.000000, 1.000000,-0.000000, 0.000000,
     0.000000, 0.000000, 0.000000, 1.000000;;
  }
  Frame Cube {
    FrameTransformMatrix {
       1.000000, 0.000000, 0.000000, 0.000000,
       0.000000, 1.000000, 0.000000, 0.000000,
       0.000000, 0.000000, 1.000000, 0.000000,
       0.000000, 0.000000, 0.000000, 1.000000;;
    }
    Mesh { //Cube_001 Mesh
      24;
      -1.000000; 1.000000;-1.000000;,
      -1.000000;-1.000000;-1.000000;,
       1.000000;-1.000000;-1.000000;,
       1.000000; 1.000000;-1.000000;,
       0.999999;-1.000001; 1.000000;,
      -1.000000;-1.000000; 1.000000;,
      -1.000000; 1.000000; 1.000000;,
       1.000000; 0.999999; 1.000000;,
       1.000000;-1.000000;-1.000000;,
       0.999999;-1.000001; 1.000000;,
       1.000000; 0.999999; 1.000000;,
       1.000000; 1.000000;-1.000000;,
      -1.000000;-1.000000;-1.000000;,
      -1.000000;-1.000000; 1.000000;,
       0.999999;-1.000001; 1.000000;,
       1.000000;-1.000000;-1.000000;,
      -1.000000; 1.000000;-1.000000;,
      -1.000000; 1.000000; 1.000000;,
      -1.000000;-1.000000; 1.000000;,
      -1.000000;-1.000000;-1.000000;,
      -1.000000; 1.000000; 1.000000;,
      -1.000000; 1.000000;-1.000000;,
       1.000000; 1.000000;-1.000000;,
       1.000000; 0.999999; 1.000000;;
      6;
      4;0;1;2;3;,
      4;4;5;6;7;,
      4;8;9;10;11;,
      4;12;13;14;15;,
      4;16;17;18;19;,
      4;20;21;22;23;;
      MeshNormals { //Cube_001 Normals
        24;
         0.000000; 0.000000;-1.000000;,
         0.000000; 0.000000;-1.000000;,
         0.000000; 0.000000;-1.000000;,
         0.000000; 0.000000;-1.000000;,
         0.000000;-0.000000; 1.000000;,
         0.000000;-0.000000; 1.000000;,
         0.000000;-0.000000; 1.000000;,
         0.000000;-0.000000; 1.000000;,
         1.000000;-0.000000; 0.000000;,
         1.000000;-0.000000; 0.000000;,
         1.000000;-0.000000; 0.000000;,
         1.000000;-0.000000; 0.000000;,
        -0.000000;-1.000000;-0.000000;,
        -0.000000;-1.000000;-0.000000;,
        -0.000000;-1.000000;-0.000000;,
        -0.000000;-1.000000;-0.000000;,
        -1.000000; 0.000000;-0.000000;,
        -1.000000; 0.000000;-0.000000;,
        -1.000000; 0.000000;-0.000000;,
        -1.000000; 0.000000;-0.000000;,
         0.000000; 1.000000; 0.000000;,
         0.000000; 1.000000; 0.000000;,
         0.000000; 1.000000; 0.000000;,
         0.000000; 1.000000; 0.000000;;
        6;
        4;0;1;2;3;,
        4;4;5;6;7;,
        4;8;9;10;11;,
        4;12;13;14;15;,
        4;16;17;18;19;,
        4;20;21;22;23;;
      } //End of Cube_001 Normals
      MeshMaterialList { //Cube_001 Material List
        1;
        6;
        0,
        0,
        0,
        0,
        0,
        0;;
        Material Material {
           0.640000; 0.640000; 0.640000; 1.000000;;
           96.078431;
           0.500000; 0.500000; 0.500000;;
           0.000000; 0.000000; 0.000000;;
          TextureFilename {"woodboards.jpg";}
        }
      } //End of Cube_001 Material List
    } //End of Cube_001 Mesh
  } //End of Cube
} //End of Root Frame

The above file converted from .x to .egg with x2egg:

<CoordinateSystem> { Y-Up-Left }

<Comment> {
  "x2egg box.x boxConvert.egg"
}
<Texture> tref1 {
  woodboards.jpg
}
<Material> mref1 {
  <Scalar> diffr { 0.64 }
  <Scalar> diffg { 0.64 }
  <Scalar> diffb { 0.64 }
  <Scalar> specr { 0.5 }
  <Scalar> specg { 0.5 }
  <Scalar> specb { 0.5 }
  <Scalar> shininess { 96.0784 }
}
<Group> Root {
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 0 1 0
      0 1 0 0
      0 0 0 1
    }
  }
  <Group> Cube {
    <Transform> {
      <Matrix4> {
        1 0 0 0
        0 1 0 0
        0 0 1 0
        0 0 0 1
      }
    }
    <Group> {
      <VertexPool> vpool1 {
        <Vertex> 0 {
          1 -1 1
          <Normal> { 0 -1 0 }
        }
        <Vertex> 1 {
          1 -1 -1
          <Normal> { 0 -1 0 }
        }
        <Vertex> 2 {
          -1 -1 -1
          <Normal> { 0 -1 0 }
        }
        <Vertex> 3 {
          -1 -1 1
          <Normal> { 0 -1 0 }
        }
        <Vertex> 4 {
          1 1 0.999999
          <Normal> { 0 1 0 }
        }
        <Vertex> 5 {
          -1 1 1
          <Normal> { 0 1 0 }
        }
        <Vertex> 6 {
          -1 1 -1
          <Normal> { 0 1 0 }
        }
        <Vertex> 7 {
          0.999999 1 -1
          <Normal> { 0 1 0 }
        }
        <Vertex> 8 {
          1 -1 1
          <Normal> { 1 0 0 }
        }
        <Vertex> 9 {
          1 1 0.999999
          <Normal> { 1 0 0 }
        }
        <Vertex> 10 {
          0.999999 1 -1
          <Normal> { 1 0 0 }
        }
        <Vertex> 11 {
          1 -1 -1
          <Normal> { 1 0 0 }
        }
        <Vertex> 12 {
          1 -1 -1
          <Normal> { 0 0 -1 }
        }
        <Vertex> 13 {
          0.999999 1 -1
          <Normal> { 0 0 -1 }
        }
        <Vertex> 14 {
          -1 1 -1
          <Normal> { 0 0 -1 }
        }
        <Vertex> 15 {
          -1 -1 -1
          <Normal> { 0 0 -1 }
        }
        <Vertex> 16 {
          -1 -1 -1
          <Normal> { -1 0 0 }
        }
        <Vertex> 17 {
          -1 1 -1
          <Normal> { -1 0 0 }
        }
        <Vertex> 18 {
          -1 1 1
          <Normal> { -1 0 0 }
        }
        <Vertex> 19 {
          -1 -1 1
          <Normal> { -1 0 0 }
        }
        <Vertex> 20 {
          1 1 0.999999
          <Normal> { 0 0 1 }
        }
        <Vertex> 21 {
          1 -1 1
          <Normal> { 0 0 1 }
        }
        <Vertex> 22 {
          -1 -1 1
          <Normal> { 0 0 1 }
        }
        <Vertex> 23 {
          -1 1 1
          <Normal> { 0 0 1 }
        }
        <Vertex> 24 {
          -1 -1 -1
          <Normal> { -0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 25 {
          -1 -1 -1
          <Normal> { -0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 26 {
          -1 -1 -1
          <Normal> { -0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 27 {
          -1 -1 1
          <Normal> { -0.57735 -0.57735 0.57735 }
        }
        <Vertex> 28 {
          -1 -1 1
          <Normal> { -0.57735 -0.57735 0.57735 }
        }
        <Vertex> 29 {
          -1 -1 1
          <Normal> { -0.57735 -0.57735 0.57735 }
        }
        <Vertex> 30 {
          -1 1 -1
          <Normal> { -0.57735 0.57735 -0.57735 }
        }
        <Vertex> 31 {
          -1 1 -1
          <Normal> { -0.57735 0.57735 -0.57735 }
        }
        <Vertex> 32 {
          -1 1 -1
          <Normal> { -0.57735 0.57735 -0.57735 }
        }
        <Vertex> 33 {
          -1 1 1
          <Normal> { -0.57735 0.57735 0.57735 }
        }
        <Vertex> 34 {
          -1 1 1
          <Normal> { -0.57735 0.57735 0.57735 }
        }
        <Vertex> 35 {
          -1 1 1
          <Normal> { -0.57735 0.57735 0.57735 }
        }
        <Vertex> 36 {
          0.999999 1 -1
          <Normal> { 0.57735 0.57735 -0.57735 }
        }
        <Vertex> 37 {
          0.999999 1 -1
          <Normal> { 0.57735 0.57735 -0.57735 }
        }
        <Vertex> 38 {
          0.999999 1 -1
          <Normal> { 0.57735 0.57735 -0.57735 }
        }
        <Vertex> 39 {
          1 -1 -1
          <Normal> { 0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 40 {
          1 -1 -1
          <Normal> { 0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 41 {
          1 -1 -1
          <Normal> { 0.57735 -0.57735 -0.57735 }
        }
        <Vertex> 42 {
          1 -1 1
          <Normal> { 0.577351 -0.57735 0.57735 }
        }
        <Vertex> 43 {
          1 -1 1
          <Normal> { 0.577351 -0.57735 0.57735 }
        }
        <Vertex> 44 {
          1 -1 1
          <Normal> { 0.577351 -0.57735 0.57735 }
        }
        <Vertex> 45 {
          1 1 0.999999
          <Normal> { 0.57735 0.57735 0.57735 }
        }
        <Vertex> 46 {
          1 1 0.999999
          <Normal> { 0.57735 0.57735 0.57735 }
        }
        <Vertex> 47 {
          1 1 0.999999
          <Normal> { 0.57735 0.57735 0.57735 }
        }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 42 39 24 27 <Ref> { vpool1 } }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 45 33 30 36 <Ref> { vpool1 } }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 43 46 37 40 <Ref> { vpool1 } }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 41 38 31 25 <Ref> { vpool1 } }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 26 32 34 28 <Ref> { vpool1 } }
      }
      <Polygon> {
        <RGBA> { 0.64 0.64 0.64 1 }
        <TRef> { tref1 }
        <MRef> { mref1 }
        <VertexRef> { 47 44 29 35 <Ref> { vpool1 } }
      }
    }
  }
}

The yabee .egg file:

<CoordinateSystem> { Z-up } 
<Material> Material.001 {
  <Scalar> diffr { 0.640 }
  <Scalar> diffg { 0.640 }
  <Scalar> diffb { 0.640 }
  <Scalar> specr { 0.500 }
  <Scalar> specg { 0.500 }
  <Scalar> specb { 0.500 }
  <Scalar> shininess { 12.5 }
  <Scalar> emitr { 0.000 }
  <Scalar> emitg { 0.000 }
  <Scalar> emitb { 0.000 }
}

  <Group> Cube {
    <Transform> {
      <Matrix4> {
        1.000 0.000 0.000 0.000 
        0.000 1.000 0.000 0.000 
        0.000 0.000 1.000 0.000 
        0.000 0.000 0.000 1.000 
      }
    }
    
    <VertexPool> Cube {
    
      <Vertex> 0 {
        1.0 0.9999999403953552 -1.0
      }
      <Vertex> 1 {
        1.0 -1.0 -1.0
      }
      <Vertex> 2 {
        -1.0000001192092896 -0.9999998211860657 -1.0
      }
      <Vertex> 3 {
        -0.9999996423721313 1.0000003576278687 -1.0
      }
      <Vertex> 4 {
        1.0000004768371582 0.999999463558197 1.0
      }
      <Vertex> 5 {
        -0.9999999403953552 1.0 1.0
      }
      <Vertex> 6 {
        -1.0000003576278687 -0.9999996423721313 1.0
      }
      <Vertex> 7 {
        0.9999993443489075 -1.0000005960464478 1.0
      }
      <Vertex> 8 {
        1.0 0.9999999403953552 -1.0
      }
      <Vertex> 9 {
        1.0000004768371582 0.999999463558197 1.0
      }
      <Vertex> 10 {
        0.9999993443489075 -1.0000005960464478 1.0
      }
      <Vertex> 11 {
        1.0 -1.0 -1.0
      }
      <Vertex> 12 {
        1.0 -1.0 -1.0
      }
      <Vertex> 13 {
        0.9999993443489075 -1.0000005960464478 1.0
      }
      <Vertex> 14 {
        -1.0000003576278687 -0.9999996423721313 1.0
      }
      <Vertex> 15 {
        -1.0000001192092896 -0.9999998211860657 -1.0
      }
      <Vertex> 16 {
        -1.0000001192092896 -0.9999998211860657 -1.0
      }
      <Vertex> 17 {
        -1.0000003576278687 -0.9999996423721313 1.0
      }
      <Vertex> 18 {
        -0.9999999403953552 1.0 1.0
      }
      <Vertex> 19 {
        -0.9999996423721313 1.0000003576278687 -1.0
      }
      <Vertex> 20 {
        1.0000004768371582 0.999999463558197 1.0
      }
      <Vertex> 21 {
        1.0 0.9999999403953552 -1.0
      }
      <Vertex> 22 {
        -0.9999996423721313 1.0000003576278687 -1.0
      }
      <Vertex> 23 {
        -0.9999999403953552 1.0 1.0
      }}
    
    
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {0.000 0.000 -1.000}
      <VertexRef> { 0 1 2 3 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {0.000 0.000 1.000}
      <VertexRef> { 4 5 6 7 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {1.000 -0.000 0.000}
      <VertexRef> { 8 9 10 11 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {-0.000 -1.000 -0.000}
      <VertexRef> { 12 13 14 15 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {-1.000 0.000 -0.000}
      <VertexRef> { 16 17 18 19 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material.001 }
      <Normal> {0.000 1.000 0.000}
      <VertexRef> { 20 21 22 23 <Ref> { Cube }}
    }
  }

your cube is lacking UV coordinates. so all uv-coords would be 0 0 which makes the cube appear as one-color.

create an uv-set in blender. make your texture use the uv-set as input-mapping coordinates and export it again.

Alright, so that fixes the .x exporter.

But Panda/pview is still rendering all polygons from some kind of master list. Any ideas there?

Panda maintains a model cache in the directory specified in your Config.prc file with model-cache-dir, to speed the loading of model files. The first time you load a model file, it is converted internally to a bam file and written to the model-cache-dir. On subsequent times when you load the same model file again, it reloads the cached version for speed.

If the datestamp on your original model file changes, Panda is supposed to detect this change and not reload the cached version in that case. However, there was a recent bug (which is fixed in the trunk, and I think also in 1.8.0) which caused this to fail for .x files and other non-native model files loaded directly.

So you will have to either:
(a) empty the cache folder yourself each time,
(b) comment out the model-cache-dir in your Config.prc file, or
© use x2egg to convert the .x file to an .egg file first, and then pview the egg file, or
(d) upgrade to the latest version of Panda.

David