Light (RW Section)

From GTAMods Wiki
Jump to navigation Jump to search
Light
RenderWare Stream Section
Vendor Criterion Games
Module Core
Module ID 0x000000
Identifier 0x12
Chunk ID 0x00000012
Versions All
Hierarchy
Parents:
Clump
Children:
Struct
Extensions:
None
File Format

Light is a section used in DFF files as child of a Clump section. It is normally accompanied by a Struct section. A light section defines a single light source that can be attached to a Frame.

Note that lights in Renderware are actual real-time lights, which are not used or supported in GTA. However, this section does occur in some of the files, shipped alongside different GTA versions.

Instead of using real-time lights, GTA fakes lightning in different ways:

  • Coronas and light cones are just textures that are projected onto the surface below them. Typically they are created within a 2dfx extension, which is a custom extension created by R* in order to fake lights.
  • The player model or vehicle model is not affected by shadows and direct light immision, e.g. they get darker if they are not in the light and brighter if they are. In GTA San Andreas those effects are faked by a lightning value, defined inside Collision Files.

Structure

The section itself typically does not contain any content. All information about the light source are stored within a Struct section, directly following the light section header. This structure contains the following information:

 4b - DWORD  - Frame Index
 4b - FLOAT  - Radius
 4b - FLOAT  - Red
 4b - FLOAT  - Green
 4b - FLOAT  - Blue
 4b - FLOAT  - Direction Angle (1-cos(alpha))
 2b - UINT16 - Flags
 2b - UINT16 - Type

The flags describe the complexity of the casted light of the light source.

 0x01 - rwLIGHTSCENE - Lights all the atomics of the object.
 0x02 - rwLIGHTWORLD - Lights the entire world.

There are also different types of light sources.

 0x01 - rpLIGHTDIRECTIONAL - Directional light source
 0x02 - rpLIGHTAMBIENT     - Ambient light source
 0x80 - rpLIGHTPOINT       - Point light source
 0x81 - rpLIGHTSPOT        - Spotlight
 0x82 - rpLIGHTSPOTSOFT    - Spotlight, soft edges

See also