xof 0302txt 0032
Header {1; 0; 1;}
// Created by 3D Canvas
Material mat_0 {
7.607844E-01;8.431373E-01;9.019608E-01;1.00E+00;;
0.00E+00;
1.00E+00;1.00E+00;1.00E+00;;
1.521569E-01;1.686275E-01;1.803922E-01;;
}
Frame Group {
FrameTransformMatrix {
1.00E+00, 0.00E+00, 0.00E+00, 0.00E+00,
0.00E+00, 1.00E+00, 0.00E+00, 0.00E+00,
0.00E+00, 0.00E+00, 1.00E+00, 0.00E+00,
0.00E+00, 0.00E+00, 0.00E+00, 1.00E+00;;
}
Mesh Cube {
8;
-5.00E-01; -5.00E-01; -5.00E-01;,
-5.00E-01; 5.00E-01; -5.00E-01;,
5.00E-01; 5.00E-01; -5.00E-01;,
5.00E-01; -5.00E-01; -5.00E-01;,
5.00E-01; -5.00E-01; 5.00E-01;,
5.00E-01; 5.00E-01; 5.00E-01;,
-5.00E-01; 5.00E-01; 5.00E-01;,
-5.00E-01; -5.00E-01; 5.00E-01;;
6;
4;0,1,2,3;,
4;4,5,6,7;,
4;3,2,5,4;,
4;7,6,1,0;,
4;1,6,5,2;,
4;3,4,7,0;;
MeshMaterialList {
1;
1;
0;;
{mat_0}
}
MeshNormals {
6;
0.00E+00; 0.00E+00; -1.00E+00;,
0.00E+00; 0.00E+00; 1.00E+00;,
1.00E+00; 0.00E+00; 0.00E+00;,
-1.00E+00; 0.00E+00; 0.00E+00;,
0.00E+00; 1.00E+00; 0.00E+00;,
0.00E+00; -1.00E+00; 0.00E+00;;
6;
4;0,0,0,0;,
4;1,1,1,1;,
4;2,2,2,2;,
4;3,3,3,3;,
4;4,4,4,4;,
4;5,5,5,5;;
}
MeshFaceWraps {
6;
0;; 0;;,
0;; 0;;,
0;; 0;;,
0;; 0;;,
0;; 0;;,
0;; 0;;;
}
MeshTextureCoords {
8;
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;;
}
}
}
AnimationSet x3dc_0 {
}
Here is your model in 'notepad.exe' Notice how the MeshTextureCords are paired, and they are both zero. This tells DirectX that when a texture is applied, the polygons are not supposed to be textured (they get color from pixels(0,0)), so in order to fix this simple model, you could modify it in notepad and save it. You just need to understand how this model data is going to render the model.
So lets see:
Mesh Cube {
8;
-5.00E-01; -5.00E-01; -5.00E-01;,
-5.00E-01; 5.00E-01; -5.00E-01;,
5.00E-01; 5.00E-01; -5.00E-01;,
5.00E-01; -5.00E-01; -5.00E-01;,
5.00E-01; -5.00E-01; 5.00E-01;,
5.00E-01; 5.00E-01; 5.00E-01;,
-5.00E-01; 5.00E-01; 5.00E-01;,
-5.00E-01; -5.00E-01; 5.00E-01;;
6;
4;0,1,2,3;,
4;4,5,6,7;,
4;3,2,5,4;,
4;7,6,1,0;,
4;1,6,5,2;,
4;3,4,7,0;;
This section says that your model has 8 vertices.
Right after the number 8 are listed the model's vertex positions, (x,y,z) respectively. Notice how there are eight lines...
The next section is the number of polygons/faces. There are 6 of these. They each consist of 4 vertices. The first one is the group of vertices 0,1,2, and 3; ... etc. This is a clue, this is called an 'indexed mesh', because there is vertex sharing for each vertex. EDIT:"for each
face not vertex".
You now have what you needed to know to begin calculating the texture coordinates. You see:
MeshTextureCoords {
8;
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;,
0.00E+00; 0.00E+00;;
}
means that for each vertex there is a UV data, and each one is set to zero just like Dabbler pointed out previously. What you want is for them to be something other than zero, right? So that the model will render some color from an image when its drawn in DirectX.
So first things first, open the file in notepad.
Using windows:
Press: 'WINKEY'+'R'
Type: notepad [filename] ie. [filename] = D:FilesDownloadsmetrecube.x
Press: 'ENTER'
So since the first set of data [U; V;,] corresponds to the first vertex (vertex 0), we don't need to modify any portion of the data for this one because the first vertex should start getting information starting from the upper left corner (U=0.0;V=0.0). Now let us look back so see what number the next vertex is:
So the next vertex in the polygon is vertex 1. We want this one to be the upper right corner of our image, so its data needs to be (U=1.0,V=0.0). So here we change the second line:
0.00E+00; 0.00E+00;, to ->
1.00E+00; 0.00E+00;,
The next vertex is vertex 2. We want this to be the the lower right corner this time, so set it to (U=1.0,V=1.0) following the same step as before.
The next vertex is vertex 3. Again we set this only this time to (U=0.0,V=1.0).
Now lets check to see if we are on the right track.
Save the file in notepad. And then launch your DBPro application.
Let me know what you see.