benilla-re systems structs docs

s_twoSqrtPi

global · models

Address
0x81207c · 4 bytes, up to 0x81207f
Type
float
Meaning
Holds 2·sqrt(π), the scale of an ambient colour into the constant harmonic term
Confidence
verified, proof one
Finding
models/lights#spherical-harmonic-terms

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.