Hi. As you can see in the screen shot the normals are the problem. I tried all calculations I could found online and cant get correct results. Maybe can you help. I tried different model formats and different parsers for them. I will post here the .x file format for my model exported from blender.
Mesh { // Cube mesh
8;
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;,
0.999999;-1.000001; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;;
12;
3;0,3,1;,
3;4,5,7;,
3;0,1,4;,
3;1,2,5;,
3;3,7,2;,
3;4,7,0;,
3;3,2,1;,
3;5,6,7;,
3;1,5,4;,
3;2,6,5;,
3;7,6,2;,
3;7,3,0;;
MeshNormals { // Cube normals
12;
-0.000000;-0.000000;-1.000000;,
0.000000; 0.000000; 1.000000;,
1.000000; 0.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000;-0.000000;-1.000000;,
0.000000;-0.000000; 1.000000;,
1.000000;-0.000001; 0.000000;,
-0.000000;-1.000000; 0.000000;,
-1.000000; 0.000000;-0.000000;,
0.000000; 1.000000; 0.000000;;
12;
3;0,0,0;,
3;1,1,1;,
3;2,2,2;,
3;3,3,3;,
3;4,4,4;,
3;5,5,5;,
3;6,6,6;,
3;7,7,7;,
3;8,8,8;,
3;9,9,9;,
3;10,10,10;,
3;11,11,11;;
} // End of Cube normals
So, if I got this correct first number 8 defines 8 vertices with x,y,z coordinates. Next number 12 are indexes, like 3;0,3,1;, means 3 vertex, with index 0, 3 and 1 which gives single face(triangle).
Then we have mesh normals, 12 normals with x,y,z. Then normal indexes: 12 indexes means 12 faces (triangles). so 3;0,0,0;, means 3 normals for 1 face.
so now some help with vertex normal calculation:
here is what i do:
for every vertex
for every face
if vertex is in this face
vertexnormal += face normal
after that i divide each vertex normal with how many time was repeted and normalize it.
it doesnt work. help pls.....
![pic1.jpg](https://uploads.gamedev.net/monthly_2018_04/pic1.jpg.3d5031324e327a08e4d0badb0b6fbe96.jpg)