M2LightingAddAmbient
function · models · primitive
- Address
0x71bc70· 98 bytes, up to0x71bcd1- Signature
void __thiscall (M2Lighting *this, const float *colour)- Meaning
- Adds an ambient colour to a lighting record and to its spherical harmonic constant terms
- Confidence
- verified, proof one
- Finding
- models/lights#spherical-harmonic-terms
- Test
models::m2_light_accumulate_difftest
Finding: Spherical harmonic terms in models: lights
An ambient colour c adds c to the ambient sum and 3.5449078·c (2√π) to each channel's
constant term. A directional colour c along d first takes d through the scene's view +0x9c
(row vector, 3×3 part) when the record has a scene, then adds c_ch·d to each channel's
directional sum, (0.212671·r + 0.71516·g + 0.072169·b)·d to the luminance-weighted sum, and c
to the directional colour sum. It then adds 2.956793·c_ch·Y_i to the nine terms of each channel,
with (x, y, z) = −d:
| i | Y_i |
|---|---|
| 0 | 0.2820948 |
| 1, 2, 3 | −0.4886025·y, 0.4886025·z, −0.4886025·x |
| 4, 5 | 1.0925484·x·y, −1.0925484·y·z |
| 6 | 0.3153916·(3z² − 1) |
| 7, 8 | −1.0925484·x·z, 0.5462742·(x² − y²) |
A light's third colour adds to the third colour sum.
The derivation is in the doc.
Callers 5
- PortraitLighting ui
- ApplyEntityLighting terrain
- ApplyMapLighting terrain
- CMapDoodadDef::AddLights terrain
- LightingAddLight models
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.