Jump to content

Sonic Adventure 2/Lighting and Fog: Difference between revisions

From SA Docs
mNo edit summary
 
Line 137: Line 137:
|4
|4
|Byte
|Byte
|Alpha
|Blue
|-
|-
|5
|5
|Byte
|Byte
|Red
|Green
|-
|-
|6
|6
|Byte
|Byte
|Green
|Red
|-
|-
|7
|7
|Byte
|Byte
|Blue
|Alpha
|-
|-
|8
|8

Latest revision as of 08:11, 25 January 2026

The following page contains information regarding lighting/fog data and their applications in Sonic Adventure 2. This information is generally stored within loose binary files found in the main game directory and are assigned to each level/scenario in code.

The external lighting/fog files can be edited using SA2LightFogEditor.

Light Information

In all versions of Sonic Adventure 2, lighting information can be found in two places: external files that are usually labeled as STG??_LIGHT.BIN files, and light structs that are found within the game's code. The games can store up to 12 sets of lighting instructions at a time, and each set is assigned to characters, objects, effects, etc. within the game's code. External lighting files will always take priority over internal lighting information, though this only applies if the level/scenario asks for a file to be loaded in the first place.

Dreamcast

Dreamcast lighting files are the basis used for all versions of the game. Each file has enough space to hold 12 sets of lights, though not all of the slots tend to be occupied depending on the level/scenario. The base lighting and ambient share the same coloration, with the main difference being their respective power settings.

Offset Type Description
0 Float(3) Light Direction (X, Y, Z)
C Float Color Multiplier
10 Float Ambient Multiplier
14 Float Red
18 Float Green
1C Float Blue

SA2B

New lighting files introduced in SA2B are labeled as STG??_LIGHT_GC.BIN, which hold some similarities with the Dreamcast lighting files. The game will always attempt to load these version-specific files for levels/scenarios that look for the standard lighting files, even if they don't exist. The primary differences are that the base light and ambient can have two distinct colors instead of sharing one with different levels of strength, and the lighting information can be selectively overwritten by enabling a flag in the file. Like the normal lighting files, these also have the capacity to hold 12 distinct lighting sets, but not all slots are required to be filled.

Offset Type Description
0 Float(3) Light Direction (X, Y, Z)
C Float Red
10 Float Green
14 Float Blue
18 Float Ambient Red
1C Float Ambient Green
20 Float Ambient Blue
24 INT32 Override Light
28 INT32 Unknown
2C INT32 Unknown

Fog Information

In all versions of the game, fog data is loaded from external files that are usually labeled as STG??_FOG.BIN, with levels that use multiple files labeling them with added letters such as A, B, or C. All files share a header denoting aspects such as the fog's color and its properties, though there are differences in the way that the games handle their information.

Dreamcast

Dreamcast fog files always include a fog table, which is a collection of 128 floats that determines the strength of the fog effect at certain distances from the player's current position. While the color settings contain an alpha component, the game ignores it.

Offset Type Description
0 INT16 Type
2 INT16 Unknown
4 Byte Alpha
5 Byte Red
6 Byte Green
7 Byte Blue
8 Float Max Distance
C Float Minimum Distance
10 Float[128] Fog Table

SA2B

Fog files found in SA2B appear to be the same as the Dreamcast files, but a key difference is that the fog table is often missing due to the fog system being reworked. While some files still contain this information, the game never uses them and their data is left in a broken state because of an improper endianness conversion. While the color settings contain an alpha component, the game ignores it.

Offset Type Description
0 INT16 Type
2 INT16 Unknown
4 Byte Blue
5 Byte Green
6 Byte Red
7 Byte Alpha
8 Float Max Distance
C Float Minimum Distance
Sonic Adventure 2 Information
General Information File FormatsLevelsTexture FilesLight and Fog DataGame Builds
Character Information Model DataAnimation FilesActionsAnimation Lists
Sound Information Voice ListMusic FilesSound Effects
Other Cutscenes