Difference between revisions of "Breakable (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
m (Material Data)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{RW Section|Breakable model|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]])''
 +
}}
  
'''Breakable model''' is one of Rockstar's [[List of RW section IDs#Rockstar.27s_Custom_Sections|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]].
+
'''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]] > Breakable model.
+
==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 [[Talk:Breakable_(RW_Section)#Meaningless values|Meaningless values]]).
  
 
==Header==
 
==Header==
  
There is a ''56 byte'' header which holds information about the amount of data arrays that follow.
+
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 [[Talk:Breakable_(RW_Section)#Meaningless values|Meaningless values]] for clarifications about the unused fields.
 +
 
 +
==Vertex data==
  
  4b - UINT32 - Offset to this data (zero if ''Breakable model'' is not used)
+
  FLOAT[3]    verts[numVertices]
  4b - UINT32  - Position rule (if 1 then position is calculated relatively to object collision model, if 0 - to clump position)
+
  FLOAT[2]    texCoords[numVertices]
  4b - UINT32  - Vertex Count
+
  BYTE[4]    preLitLum[numVertices] (RGBA)
  4b - UINT32 - Offset to vertices (''unused'')
 
  4b - UINT32  - Offset to texture coors (''unused'')
 
  4b - UINT32  - Offset to vertex colors (''unused'')
 
  4b - UINT32  - Face Count
 
  4b - UINT32  - Offset to faces (''unused'')
 
  4b - UINT32  - Offset to material assignments (''unused'')
 
  4b - UINT32  - Material Count (= Fragment Count)
 
  4b - UINT32  - Offset to textures  (''unused'')
 
  4b - UINT32  - Offset to texture names  (''unused'')
 
  4b - UINT32  - Offset to mask names  (''unused'')
 
  4b - UINT32  - Offset to material properties (''unused'')
 
  
==Geometry Data==
+
==Triangle data==
  
  Vertices: array of <nowiki>[Vertex Count]</nowiki> elements
+
  UINT16[3]   vertIndices[numTriangles]
  12b - FLOAT[3] - XYZ
+
  UINT16     matIndices[numTriangles]
 
UV Coords: array of <nowiki>[Vertex Count]</nowiki> elements
 
    8b - FLOAT[2]  - UV
 
 
  Vertex Colors: array of <nowiki>[Vertex Count]</nowiki> elements
 
    4b - BYTE[4]  - RGBA
 
 
Faces: array of <nowiki>[Face Count]</nowiki> elements
 
    6b - UINT16[3] - 3 indices into vertex array
 
 
Material Assignments: array of <nowiki>[Face Count]</nowiki> elements
 
    2b - UINT16    - Material ID
 
  
==Material Data==
+
==Material data==
  
Each polygon group sharing the same material is treated as a separate fragment when the object is split up.
+
Each polygon group sharing the same material is treated as a separate fragment when the object is split up:
  
  Texture Names: array of <nowiki>[Material Count]</nowiki> elements
+
  CHAR[32]    textureNames[numMaterials]
   32b - CHAR[32] - Texture Name
+
  CHAR[32]    textureMasks[numMaterials]
   
+
  FLOAT[3]    ambientColors[numMaterials] (RGB normalized in range [0,1])
Alpha Names: array of <nowiki>[Material Count]</nowiki> elements
 
   32b - CHAR[32] - Alpha Texture Name
 
   
 
Material Properties: array of <nowiki>[Material Count]</nowiki> elements
 
   12b - FLOAT[3] - material color (red/green/blue)
 
  
 
==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 seperate files.
+
 
 +
* {{GTAF|269717|Breakable Objects Export Script}} by {{U|Deniska}}. A script for 3dsMax which allows to export Breakable model information to separate 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