diffuseSphericalHarmonics property

List<Vector3>? get diffuseSphericalHarmonics

irradianceCoefficients brought onto the engine's diffuse contract: the Lambertian A_l band factors and the 1/pi BRDF term folded in, ready for EnvironmentMap.fromKtx2Bytes or EnvironmentMap.fromGpuTextures.

Null when the source declared no coefficients. Exporters disagree on whether they pre-convolve, so check the result with describeDiffuseSphericalHarmonics: its mean must match the source environment's average radiance, not pi times it.

Implementation

List<Vector3>? get diffuseSphericalHarmonics {
  if (irradianceCoefficients.length != kDiffuseShCoefficientCount) {
    return null;
  }
  // A_l / pi is 1, 2/3, 1/4 for bands 0, 1, 2.
  return <Vector3>[
    irradianceCoefficients[0].clone(),
    for (var k = 1; k <= 3; k++) irradianceCoefficients[k] * (2.0 / 3.0),
    for (var k = 4; k <= 8; k++) irradianceCoefficients[k] * 0.25,
  ];
}