I have a little problem. Say I want to achieve this pipeline:
Blender+Photoshop -> [some resource package containing .egg, textures and materials]
Consider this .egg file:
<Texture> tref1 {
colormap.png
}
<Material> mref1 {
<Scalar> diffr { 0.6 }
<Scalar> diffg { 0.6 }
<Scalar> diffb { 0.6 }
<Scalar> specr { 0.5 }
<Scalar> specg { 0.5 }
<Scalar> specb { 0.5 }
<Scalar> shininess { 90.0 }
}
<Group>
{
<VertexPool> vpool1
{
<Vertex> 0 {
-1 1 0
<UV> { 0 1 }
<Normal> { 0 0 1 }
}
<Vertex> 1 {
1 1 0
<UV> { 1 1 }
<Normal> { 0 0 1 }
}
<Vertex> 2 {
1 -1 0
<UV> { 1 0 }
<Normal> { 0 0 1 }
}
<Vertex> 3 {
-1 -1 0
<UV> { 0 0 }
<Normal> { 0 0 1 }
}
}
<Polygon> {
<RGBA> { 0.6 0.6 0.6 1 }
<TRef> { tref1 }
<MRef> { mref1 }
<VertexRef> { 0 1 2 3 <Ref> { vpool1 } }
}
}
If I want to add more texture-references in there I just add for example:
<Texture> tref2 {
normalmap.png
}
AND I have to add the reference to the polygon… EACH polygon to use the texture:
<Polygon> {
<RGBA> { 0.6 0.6 0.6 1 }
<TRef> { tref1 }
<TRef> { tref2 }
<MRef> { mref1 }
<VertexRef> { 0 1 2 3 <Ref> { vpool1 } }
}
Well now… There is no way I’m doing that manually for models that may contain hundreds of polygons or more.
I know there is YABEE but it isn’t reliable as it isn’t maintained and it doesn’t seem compatible with latest versions of Blender (2.72 while writing this).
I looked into exporting from blender to .x files and then convert from .x to .egg. Thats how I got the .egg file I’ve presented. However, I can’t seem to make a .x-file reference more than one texture.
Look at the bottom of this .x file:
xof 0303txt 0032
Frame Root {
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;;
}
Frame obj_plane_000 {
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 {
4;
-1.000000;-1.000000; 0.000000;,
1.000000;-1.000000; 0.000000;,
1.000000; 1.000000; 0.000000;,
-1.000000; 1.000000; 0.000000;;
1;
4;0,1,2,3;;
MeshNormals {
1;
0.000000; 0.000000; 1.000000;;
1;
4;0,0,0,0;;
}
MeshTextureCoords {
4;
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;;
}
MeshMaterialList {
1;
1;
0;;
Material mat_plane_000 {
0.640000; 0.640000; 0.640000; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"colormap.png";}
}
}
}
}
}
We got a reference to a texture called “colormap.png”.
But I can’t seem to add more references! I’ve looked everywhere on the net and nowhere does there appear to be a desire among people to create models with more than one texture!
I’ve tried:
Material mat_plane_000 {
0.640000; 0.640000; 0.640000; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"colormap.png";"normalmap.png"}
}
Material mat_plane_000 {
0.640000; 0.640000; 0.640000; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"colormap.png";}
TextureFilename {"normalmap.png";}
}
Material mat_plane_000 {
0.640000; 0.640000; 0.640000; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename texture1 {"colormap.png";}
TextureFilename texture2 {"normalmap.png";}
}
I can’t think of anything else. I’m considering just writing a program that deals with .egg files and sets them up the way I want but sigh I… dont… want to… if I don’t have to…