Question about .bod files

The place to discuss scripting and game modifications for X³: Farnham's Legacy

Moderators: Moderators for English X Forum, Scripting / Modding Moderators, Moderators for the X3:FL Forums

Post Reply
User avatar
ubuntufreakdragon
Posts: 5189
Joined: Thu, 23. Jun 11, 14:57
x4

Question about .bod files

Post by ubuntufreakdragon » 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
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?
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

User avatar
JSDD
Posts: 1378
Joined: Fri, 21. Mar 14, 20:51
x3tc

Re: Question about .bod files

Post by JSDD » Wed, 1. Mar 23, 22:50

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)
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.


Mission Director Beispiele

User avatar
ubuntufreakdragon
Posts: 5189
Joined: Thu, 23. Jun 11, 14:57
x4

Re: Question about .bod files

Post by ubuntufreakdragon » Wed, 1. Mar 23, 23:26

Danke, das hilft mir sehr. (Thanks)
Du hast nicht zufällig eine fertige .cpp rumliegen um die Positions tabellen einer affinen Abbildung zu unter ziehen? (größer kleiner machen, und das ganze bod verschieben)
Wollte da einige kleinere fixes erstellen, bullets größer mach, damit die treffen schiffsmittelpunkte verschieben, wenn die scene das nicht ohne modified zulässt(weil Tships dann geändert wird z.b. Par_var_2_Perseus), sowas.
Ansonsten schreibe ich die selber, ist ja kein Problem.


PS: Hast du noch Kontacht zu Ghostrider?
ein LOD für sein Boron HQ wäre schön.
Bei X4 musste schließlich sich solange beschwert werden bis das Boron DLC kam.
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

User avatar
JSDD
Posts: 1378
Joined: Fri, 21. Mar 14, 20:51
x3tc

Re: Question about .bod files

Post by JSDD » Wed, 1. Mar 23, 23:51

ubuntufreakdragon wrote:
Wed, 1. Mar 23, 23:26
Danke, das hilft mir sehr. (Thanks)
Du hast nicht zufällig eine fertige .cpp rumliegen um die Positions tabellen einer affinen Abbildung zu unter ziehen? (größer kleiner machen, und das ganze bod verschieben)
Wollte da einige kleinere fixes erstellen, bullets größer mach, damit die treffen schiffsmittelpunkte verschieben, wenn die scene das nicht ohne modified zulässt(weil Tships dann geändert wird z.b. Par_var_2_Perseus), sowas.
Ansonsten schreibe ich die selber, ist ja kein Problem.
hast ne pm erhalten ^^
// allerdings ohne "größer-machen" funktion usw, nur laden / speichern (extra so, damit ich den baustein in andere graphik apps nach belieben handle-n kann)
// denke das kriegst du hin ;-)
ubuntufreakdragon wrote:
Wed, 1. Mar 23, 23:26
PS: Hast du noch Kontacht zu Ghostrider?
ein LOD für sein Boron HQ wäre schön.
Bei X4 musste schließlich sich solange beschwert werden bis das Boron DLC kam.
nope, kein kontakt ... aber er war hin & wieder hier unterwegs (?)
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.


Mission Director Beispiele

Post Reply

Return to “X³: Farnham's Legacy - Scripts and Modding”