benilla-re systems structs docs

M2LightingAddSpecular

function · models · primitive

Address
0x71bf60 · 36 bytes, up to 0x71bf83
Signature
void __thiscall (M2Lighting *this, const float *colour)
Meaning
Adds a light's third colour to a lighting record's sum
Confidence
verified, proof one
Finding
models/lights#spherical-harmonic-terms
Test
models::m2light_accum_vec3_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:

iY_i
00.2820948
1, 2, 3−0.4886025·y, 0.4886025·z, −0.4886025·x
4, 51.0925484·x·y, −1.0925484·y·z
60.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 1

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.