Difference between revisions of "Breakable (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
 
 
(20 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Mesh Extension|RW Section|0x0253F2FD}}
+
{{RW Section
 +
| NAME = Breakable
 +
| VENDORNAME = Rockstar Games
 +
| MODULENAME = Plug-In
 +
| MODULEID = 0253F2
 +
| IDENTIFIER = FD
 +
| VERSION = 3.6.0.3 (and higher)
 +
| PARENTS = [[Geometry (RW Section)|Geometry]] ''([[Extension (RW Section)|Extension]])''
 +
}}
  
'''Mesh Extension''' is one of Rockstar's [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom sections]] used in [[:Category:GTA SA|GTA San Andreas]]. It has the Offset '''0x0253F2FD''' and is used to create breakable objects for the game. It contains information how to split the objects after destroying them in any way. An object including this section needs to be defined in the [[object.dat|Object.dat]] file which is locatet in the data folder of the game.
+
'''Breakable''', formerly '''Breakable Model''', is one of Rockstar's [[List of RW section IDs|custom sections]] used in [[GTA San Andreas]]. It contains information on how to split breakable objects when they are hit. An object including this section has to be defined in [[object.dat]].
  
The typical location in a SA [[model file|dff]] section hierarchy is ''[[Clump (RW Section)|Clump]] > [[Geometry List (RW Section)|Geometry List]] > [[Geometry (RW Section)|Geometry]] > [[Extension (RW Section)|Extension]] > Mesh Extension.
+
==Magic number==
  
=Binary structure=
+
The initial ''4 bytes'' sequence signals the usage of the extension:
  
==Header==
+
UINT32  magicNumber
  
The header includes 4 bytes. Those bytes are the same as in the [[Night_Vertex_Colors_%28RW_Section%29|Night Vertex Color]] Section.
+
If zero, the section ends here. A non-zero value has no particular meaning and can be any (see [[Talk:Breakable_(RW_Section)#Meaningless values|Meaningless values]]).
  
  4b - BYTE[]  - unknown (Can be left 0)
+
==Header==
 
 
==Subheader==
 
 
 
Each section contains an subheader of 52 bytes which inculdes information about the count of the data-arrays following at the end of the file.
 
 
 
  4b - UINT32  - Allways 1
 
  4b - UINT32  - VertexCount
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - FacesCount
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - ObjectsCount
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
  4b - UINT32  - Unknown (usually 0)
 
 
 
The subheader information are used to define the number of the array entries follow after the subheader
 
 
 
==Vertex Information==
 
 
 
The vertex section contains all vertieces. The number of entries is the same as the VertexCount from the subheader. The structure is a 3-Point Floating Array:
 
 
 
12b - FLOAT[] - XYZ
 
 
 
==UV Mapping Coords==
 
 
 
Contains the UV MappingCoords for each vertex. The index of the vertex is also the index of the mappingcoord information.
 
 
 
  8b - FLOAT[] - UV
 
 
 
==VCol Information==
 
 
 
The vertex color section contains information about the vertex colors. Here the index of the vertex is also the index of the [[Vertex Color|VCol]] information.
 
 
 
  4b - BYTE[]  - RGBA
 
 
 
==Faces==
 
 
 
The faces section contains infromation about the vertex which are connected to an face. Each face is an triangle (so it has 3 vertex). The section contains a specific number of faces (FacesCount). Each entry is an index of a vertex defined below.
 
 
 
  2b - UINT16  - VertexIndex1
 
  2b - UINT16  - VertexIndex2
 
  2b - UINT16  - VertexIndex3
 
 
 
Because of the UInt16 values the number of vertexes is limited to 65535.
 
 
 
==Materials==
 
 
 
The materials section contains information about the index to the "material". The material is the number of the object. Each entry in this section has the same index as an face. It gives the face with the same index an ID which connects the face to an object.
 
 
 
  2b - UINT16  - MaterialID
 
  
==Textures==
+
There is a ''52 byte'' header which holds information about the amount of data arrays that follow:
  
The textures section contains all names of the textures used by an object. The number of the entries is the same as ObjectCount
+
UINT32  posnRule (0 = OBJECT_ORIGIN, 1 = COLLISION_ORIGIN)
 +
// Vertex data
 +
UINT16  numVertices
 +
UINT16 
 +
UINT32  (assumed offset to verts, unused)
 +
UINT32  (assumed offset to texCoords, unused)
 +
UINT32  (assumed offset to preLitLum, unused)
 +
// Triangle data
 +
UINT16  numTriangles
 +
UINT16 
 +
UINT32  (assumed offset to vertIndices, unused)
 +
UINT32  (assumed offset to matIndices, unused)
 +
// Material data
 +
UINT16  numMaterials
 +
UINT16 
 +
UINT32  (assumed offset to textures, unused)
 +
UINT32  (assumed offset to textureNames, unused)
 +
UINT32  (assumed offset to textureMasks, unused)
 +
UINT32  (assumed offset to ambientColors, unused)
  
32b - STRING  - TextureName
+
The position rule imposes whether to calculate the position relatively to the collision model or to the clump/atomic ''RwFrame''. See [[Talk:Breakable_(RW_Section)#Meaningless values|Meaningless values]] for clarifications about the unused fields.
  
==Alphas==
+
==Vertex data==
  
The alpha section contains additional information for the textures section: the alphanames. The section inculdes as many entries as the textures section.
+
FLOAT[3]    verts[numVertices]
 +
FLOAT[2]    texCoords[numVertices]
 +
BYTE[4]    preLitLum[numVertices] (RGBA)
  
32b - STRING  - AlphaName
+
==Triangle data==
  
==Unknown==
+
UINT16[3]  vertIndices[numTriangles]
 +
UINT16      matIndices[numTriangles]
  
This section is currently unknown. It includes several floating point values which are mostly 1.0. The number of entries is the same as the ObjectCount.
+
==Material data==
  
  4b - FLOAT    - Unknown (Mostly 1.0)
+
Each polygon group sharing the same material is treated as a separate fragment when the object is split up:
  4b - FLOAT    - Unknown (Mostly 1.0)
 
  4b - FLOAT    - Unknown (Mostly 1.0)
 
  
=Object.dat entry=
+
CHAR[32]    textureNames[numMaterials]
 +
CHAR[32]    textureMasks[numMaterials]
 +
FLOAT[3]    ambientColors[numMaterials] (RGB normalized in range [0,1])
  
You have to define the object in the object.dat to get it work.
+
==Tools and Scripts==
  
=Tools and Scripts=
+
* {{GTAF|269717|Breakable Objects Export Script}} by {{U|Deniska}}. A script for 3dsMax which allows to export Breakable model information to separate files.
  
* [http://www.gtaforums.com/index.php?showtopic=269717 Breakable Objects Export Script] by [[User:Deniska|Deniska]]. A script for 3dsMax which allows to export MeshExtension information to seperate files.
+
{{N|SA}}

Latest revision as of 13:02, 11 September 2020

Breakable
RenderWare Stream Section
Vendor Rockstar Games
Module Plug-In
Module ID 0x0253F2
Identifier 0xFD
Chunk ID 0x0253F2FD
Versions 3.6.0.3 (and higher)
Hierarchy
Parents:
Geometry (Extension)
Children:
None
Extensions:
None
File Format

Breakable, formerly Breakable Model, is one of Rockstar's custom sections used in GTA San Andreas. It contains information on how to split breakable objects when they are hit. An object including this section has to be defined in object.dat.

Magic number

The initial 4 bytes sequence signals the usage of the extension:

UINT32  magicNumber

If zero, the section ends here. A non-zero value has no particular meaning and can be any (see Meaningless values).

Header

There is a 52 byte header which holds information about the amount of data arrays that follow:

UINT32  posnRule (0 = OBJECT_ORIGIN, 1 = COLLISION_ORIGIN)
// Vertex data
UINT16  numVertices
UINT16  
UINT32  (assumed offset to verts, unused)
UINT32  (assumed offset to texCoords, unused)
UINT32  (assumed offset to preLitLum, unused)
// Triangle data
UINT16  numTriangles
UINT16  
UINT32  (assumed offset to vertIndices, unused)
UINT32  (assumed offset to matIndices, unused)
// Material data
UINT16  numMaterials
UINT16  
UINT32  (assumed offset to textures, unused)
UINT32  (assumed offset to textureNames, unused)
UINT32  (assumed offset to textureMasks, unused)
UINT32  (assumed offset to ambientColors, unused)

The position rule imposes whether to calculate the position relatively to the collision model or to the clump/atomic RwFrame. See Meaningless values for clarifications about the unused fields.

Vertex data

FLOAT[3]    verts[numVertices]
FLOAT[2]    texCoords[numVertices]
BYTE[4]     preLitLum[numVertices] (RGBA)

Triangle data

UINT16[3]   vertIndices[numTriangles]
UINT16      matIndices[numTriangles]

Material data

Each polygon group sharing the same material is treated as a separate fragment when the object is split up:

CHAR[32]    textureNames[numMaterials]
CHAR[32]    textureMasks[numMaterials]
FLOAT[3]    ambientColors[numMaterials] (RGB normalized in range [0,1])

Tools and Scripts