Update lighting engine documentation
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

This commit is contained in:
Agent X 2025-12-06 23:57:29 -05:00 committed by GitHub
parent b4a3939014
commit 0e65a1ddd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,25 +8,29 @@ The Lighting Engine is a vertex point lighting system built directly into sm64co
To use the Lighting Engine, you need to figure out how you want to approach using it given the different modes it has. There are also 2 methods to enable the lighting engine, either by setting the ambient color, or spawning a point light in.
If you want to make a vertex buffer not be affected by the lighting engine even when it's enabled, you can use `gsSPVertexNonGlobal` in the displaylist instead of `gsSPVertex`. This tells the renderer to not apply any of the effects Lua can do.
## Section 2: Modes
The lighting engine has 3 modes you can switch between using `le_set_mode(mode)`.
1. `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED`: (Default) Applies lighting to every shaded and vertex colored surface minus some geometry and menus.
1. `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED`: Applies lighting to every shaded and vertex colored surface minus some geometry and menus.
2. `LE_MODE_AFFECT_ALL_SHADED`: Applies lighting to every shaded surface minus some geometry and menus.
3. `LE_MODE_AFFECT_ONLY_GEOMETRY_MODE`: Only applies lighting to geometry that has the `G_LIGHTING_ENGINE_EXT` geometry mode.
3. `LE_MODE_AFFECT_ONLY_GEOMETRY_MODE`: **(Default)** Only applies lighting to geometry that has the `G_LIGHTING_ENGINE_EXT` geometry mode.
`LE_MODE_AFFECT_ONLY_GEOMETRY_MODE` was the only "mode" until djoslin0 improved the lighting engine and came up with a system for affecting shaded surfaces without needing to apply the lighting engine geometry mode to every actor and level manually.
I recommend you use `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED` since that generally covers everything and doesn't require any additional effort like manually adding the lighting engine flag to everything.
## Section 3: Tonemapping
The lighting engine has 4 tonemapping modes you can switch between using `le_set_tone_mapping(toneMapping)`.
1. `LE_TONE_MAPPING_TOTAL_WEIGHTED`: Weighs the combined ambient color and lights together, can look slightly dim.
2. `LE_TONE_MAPPING_WEIGHTED`: (Default) Weights the lights on top of the ambient color instead of with it, generally looks the best with good color balance.
2. `LE_TONE_MAPPING_WEIGHTED`: **(Default)** Weights the lights on top of the ambient color instead of with it, generally looks the best with good color balance.
3. `LE_TONE_MAPPING_CLAMP`: The sum of the lights and ambient color clamped between 0 and 255. Colors can look overexposed if lights are too bright.
@ -94,4 +98,4 @@ You can also make your own light behavior and call `bhv_point_light_init()` and
| `le_get_light_intensity(id)` | Gets a lighting engine point light's `intensity` |
| `le_set_light_intensity(id, intensity)` | Sets a lighting engine point light's `intensity` |
| `le_get_light_use_surface_normals(id)` | Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
| `le_set_light_use_surface_normals(id, useSurfaceNormals)` | Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
| `le_set_light_use_surface_normals(id, useSurfaceNormals)` | Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |