hi ubuntu !!
lang nix mehr von dir bzgl x3 gehört ... bist wohl in x4 versunken ?!
... ich versuchs mal:
ubuntufreakdragon wrote: ↑Tue, 28. Feb 23, 05:14
If you decompile a bob file it contains two lists of numbers (sometimes more for lods).
The first list looks like a list of vertices.
Code: Select all
-4094; 7103; 3751; // 0
-2451; 7152; 4764; // 1
-4082; 7123; 4163; // 2
it is ... divide those number by 500.0f (floating point), and scale (that means multiply) it by the very first number (after those MATERIAL lines) in that .bod file
=> that gets you the correct positions "relative" to other X3 bod files
ubuntufreakdragon wrote: ↑Tue, 28. Feb 23, 05:14
The second list looks like a list of faces
Code: Select all
0; 0; 1; 2; -25; 1; 0.323944; 0.346695; 0.336319; 0.355316; 0.326920; 0.346207; /! N: { -0.000107; -0.998825; 0.048492; } !/ // 0
There are some values I don't know their purpose.
the 2,3&4 value seam to be the 3 vertex ids forming the face.
What is the leading 0 used for?
What is the purpose of the ints 5&6?
what are the floats 7-12 used for?
(sorry dass ich bei 0 anfang zu zählen)
# 0: material index ... that describes essentially what texture(s) to use for that face (that means triangle, all meshes in x3 are "triangularized" [heißt das so? ^^])
# 1: vertex index A (array index into "array of vertices" which is the first bunch of "3-value-lines" [which are 3D point coords xyz])
# 2: vertex index B
# 3: vertex index C
# 4: flags (...)
IF (flags == -25)
... # 5: smoothing group
... # 6: texture coord of vertex A.u
... # 7: texture coord of vertex A.v
... # 8: texture coord of vertex B.u
... # 9: texture coord of vertex B.v
... #10: texture coord of vertex C.u
... #11: texture coord of vertex C.v
ELSE IF (flags == -9)
... # 5: texture coord of vertex A.u
... # 6: texture coord of vertex A.v
... # 7: texture coord of vertex B.u
... # 8: texture coord of vertex B.v
... # 9: texture coord of vertex C.u
... #10: texture coord of vertex C.v
ELSE
... error ... kann ich selber nicht zuordnen ^^
those "texture coords" describe the position in the texture, from where to read the pixel (or
"texel" for that matter)
"smoothing group" tells you what faces' normals (orthogonale vektoren der faces) you gotta get "smoothed" (meaning "interpolating" the normals of all triangles / faces sharing that vertex)
// note: normals are being used per-vertex, not per-face in rendering ...
// note 2: all faces of the same smoothing group look "smooth-shaded" (rundlich), not
"flat-shaded"
IF (flags == -25)
... then you get additional 9 numbers afterwards, telling you vertexnormal.A.xyz / vertexnormal.B.xyz / vertexnormal.C.xyz
ELSE IF (flags == -9)
... then you get only 3 additional numbers (after that "/! N:") ... then its just 1 normal
thats all, basically ... if you need a ".cpp" to read that, just let me know ^^ (its rubbish, but it works)
you might be interested in "developer network/documentation/related paged/advanced: the 3D engine" (findest du auf der start seite hier im forum)