Geometry (RW Section)

From GTAModding
Jump to: navigation, search
RW Stream Section

Geometry is a container chunk used in DFF files as child of a Geometry List section. The chunk itself does not store any data at all. All additional information get stored inside a Struct which directly follows this one as a child. Geometry is one of the most important chunks inside a .dff model file. It stores geometry information for models (like the mesh and the texture maps).


The format of the Geometry's Struct chunk is as follows:

int32        format (see below)
int32        number of triangles (numTriangles)
int32        number of vertices (numVertices)
int32        number of morph targets (numMorphTargets) (morphing is not used in GTA series, so this is always 1)
#if version < 0x34000
  surface properties:
    float32  ambient
    float32  specular
    float32  diffuse

#if (format & rpGEOMETRYNATIVE) == 0
    #if (format & rpGEOMETRYPRELIT)
        RwRGBA   prelitcolor[numVertices] (RwRGBA: uint8 r, g, b, a)

        #repeat numTexSets (see below)
            RwTexCoords    texCoords[numVertices]  (RwTexCoords: float32 u, v)
    RpTriangle   triangles[numTriangles]  (RpTriangle: uint16 vertex2, vertex1, materialId, vertex3)

#repeat numMorphTargets
    RwSphere    boundingSphere    (RwSphere: float32 x, y, z, radius)
    bool32      has vertices
    bool32      has normals
    #if has vertices
        RwV3d   vertices[numVertices] (RwV3d: float32 x, y, z)
    #if has normals
        RwV3d   normals[numVertices]


The following flags describe the behaviour of the mesh during the rendering progress. Some of the flags indicate the existence of data inside the following file format.

Flag Name Description
0x00000001 rpGEOMETRYTRISTRIP Is triangle strip (if disabled it will be an triangle list)
0x00000002 rpGEOMETRYPOSITIONS Vertex translation
0x00000004 rpGEOMETRYTEXTURED Texture coordinates
0x00000008 rpGEOMETRYPRELIT Vertex colors
0x00000010 rpGEOMETRYNORMALS Store normals
0x00000020 rpGEOMETRYLIGHT Dynamic vertex lightning (?)
0x00000040 rpGEOMETRYMODULATEMATERIALCOLOR Modulate material color
0x00000080 rpGEOMETRYTEXTURED2 Texture coordinates 2
0x01000000 rpGEOMETRYNATIVE Native Geometry

Bits 16-23 (mask 0x00FF0000) in the format description give the number of texture coordinate sets (numTexSets). If the value in the file is zero, rpGEOMETRYTEXTURED means there is one set of texture coordinates, rpGEOMETRYTEXTURED2 means there are two.

If rpGEOMETRYNATIVE is set, the platform dependent geometry data is to be found in the Native Data chunk.

Child sections


The extension of an geometry usually holds the following sections in the order they are listed in here:

See also


^ *
^ *

v · d · e
San Andreas Grand Theft Auto: San Andreas
File Formats.b.col.cfg.cut.dff.dat.fxp.gxt.ide.ifp.img.iplnodes*.dat.ped.rep.rrr.scm.set.txd
DocumentationAudioCryptographyCutscenesGame memoryHandling.cfgMap ListingMission PacksOpcodesPathsReplaysSavesScriptsSound EffectsStatisticsVehicles
ToolsCLEOCollision File Editor IIENBSeriesG-ToolsIMG ToolLimit AdjusterMap EditorMod LoaderSan Andreas Audio ToolkitSanny BuilderTXD Workshop
TutorialsSan Andreas v2.0 ModdingHow to create a missionHow to create a threadHow to use Map EditorVehicle Mod Installation
ModificationsDesign Your Own MissionGostown ParadiseGTA: UnitedMyriad Islands
MultiplayergtaTournamentMulti Theft AutoSan Andreas Multiplayer(more...)
Useful linksCommunity portalDiscussion forumsMods on GTAGarage.comOpcodes database
v · d · e
Vice City Grand Theft Auto: Vice City
File Formats.adf.b.col.cfg.dff.dat.gxt.ide.ifp.img/.dir.ipl.raw/.sdt.rep.scm.txd
DocumentationAudioHandlingMap ListingOpcodesScript PathsSavesSound EffectsStatisticsVehicles
ToolsCLEOCollision File Editor IIG-ToolsGXT EditorIMG ToolLimit AdjusterKEd (map editor)Sanny BuilderTXD Workshop
TutorialsHow to create a missionHow to create a threadVehicle Mod Installation
MultiplayerGTA:LC MultiplayergtaTournamentMulti Theft AutoState Of Liberty OnlineVice City MultiplayerVice City Online
Useful linksCommunity portalDiscussion forumsMods on GTAGarage.comModding VC Mobile versionOpcodes database