Light (RW Section)

From GTAMods Wiki
Revision as of 18:43, 9 May 2016 by Aschratt (talk | contribs) (Created page with "{{RW Section|Light|0x0012}} '''Light''' is a section used in DFF files as child of a Clump section. It is normally accompanied by a St...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
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