The attaching matrix is defined in the HIM file, look at this example
[_ROOT_]
VisibilitySphere 78.89842
CollisionObject sphere 85.89842 0.0 0.0 0.0
[Hull1]
Mesh Hull1
Parent _ROOT_
Attaching 0 1.2 0 -1.2 0 0 0 0 1 63.3034 0.0299933 2.29914
CollisionObject c1a
CollisionObject c2a
CollisionObject c3a
CollisionObject c4a
CollisionObject c5a
CollisionObject c6a
CollisionObject c7a
[Hull1_dmg]
Mesh Hull1_dmg
Parent _ROOT_
Hidden
Attaching 0 1.2 0 -1.2 0 0 0 0 1 63.3034 0.0299933 2.29914
CollisionObject c1b
CollisionObject c2b
CollisionObject c3b
CollisionObject c4b
CollisionObject c5b
CollisionObject c6b
CollisionObject c7b
[Hull2]
Mesh Hull2
Parent _ROOT_
Attaching 0 1.2 0 -1.2 0 0 0 0 1 -4.22264 0.0300011 2.26734
CollisionObject c8a
CollisionObject c9a
CollisionObject c10a
CollisionObject c11a
CollisionObject c12a
CollisionObject c13a
CollisionObject c14a
The attaching line forms a 3 by 4 matrix
0 1.2 0
-1.2 0 0
0 0 1
63.3034 0.0299933 2.29914
The last line is the translation, so this mesh is at x = 63.3034 , y = 0.0299933, z = 2.29914 relative to the root bone.
The rest is contains the rotation and scaling. An un-rotated, un-scaled mesh would have a matrix like this.
1 0 0
0 1 0
0 0 1
A scaled mesh would have a matrix like this
2 0 0
0 2 0
0 0 2
From this example you can see that if is rotated in the XY plane and scaled by a factor of 1.2 in the same plane . Basically the matrix represents the equation
x = (x*0) + (y*1.2) +(z*0)
y = (x*-1.2) + (y+8) + (z*0)
z = (x*0) + (y*0) + (z*1)
x = 1.2 * y;
y = -1.2 * x;
z = z;
My theory is that either IL2 doesn't rotate the normals correctly, or it calculates it's own normals from the vertex data.
If it calculates it's own normals, then the vertex order is important. A triangle is defined by three points P1,P2,P3. The normal calculated from P1,P2,P3 is totally in the opposite direction from the normal calculated from P3,P2,P1.
This is called the "winding order" and is used a lot in graphics code. You can even cull triangles based on winding order. Graphics engines have commands for it.
https://www.opengl.org/wiki/Face_CullingIf that is the case you need to look for a tool that can manipulate your mesh for you, swapping the winding order and comparing the results with what you have now. Not trivial.
The second possibility is that IL2 does not rotate the normals contained in the mesh correctly. This is harder to prove. I would go through the mesh and replace every normal with a fixed value. Say 0,1,0
If Il2 does not rotate the normals, the lighting will be consistent across the entire mesh, if the lighting varies by mesh part, then the normals are being rotated.
Then it becomes more complex, it becomes guess work. We can definitely see that the normals are not being handled correctly, but what have they done?
I would have to write some code to test out a few ideas. My first guess would be to multiply all the normals by the inverse of the attaching matrix, but it's a guess.
Let me know what you are capable of doing and I'll see if I can help out with the rest.