3D engine that AI agents drive
Add multiple scattering to the environment specular (part of #167)
Nguyen Xuan Anf8103d7f9f2a
diff --git a/bench/reference/README.md b/bench/reference/README.mdindex fc3396b9..cdb567d5 100644--- a/bench/reference/README.md+++ b/bench/reference/README.md@@ -901,3 +901,29 @@ Issue #231 inferred that surfaces between the towers get the whole sky in 67js wRow bands of 60 rows, 67js over Cycles with the sun off: 0.99, 0.98, 0.96, 0.94, 0.92, 0.90 down to row 360, then 1.55, 3.31 and 3.65 over the river. Full light gives the same bottom bands (1.75, 3.13, 3.37).The towers and the quay are slightly darker in 67js than in Cycles with only the sky, not brighter, so the canyon walls and the street do not get too much sky light. The river is 3 to 4 times brighter, but taking all the sky's diffuse light away (`--ambient 0`) removes only 0.007 to 0.010 of an excess of 0.021 to 0.037, so 67js stays 2.6 to 2.8 times over Cycles with no ambient at all. Even a perfect occlusion of the sky light in the river could close about a third of the gap, and the walls give no sign that the occlusion is missing. The rest comes from what the water draws besides diffuse sky: the reflection of the lit windows and the lamps (`src/water-reflection.js`), which is the part #195 works on. No sky visibility grid was built.++## Multiple scattering in the environment specular (2026-11-03, part of issue #167)++Re-measured on current main, `metal` was still 0.1036 against Cycles (EEVEE 0.0916), `car-paint` 0.1037 and `brushed-film` 0.1029, so the object probes of #209 had held. FLIP over screen regions of `metal` (GPU against Cycles, EEVEE in brackets, mean luminance difference to Cycles in the last column, regions cut from the projected bounds of each part):++| Region | pixels | FLIP | share of the error | luminance, 67js minus Cycles (EEVEE) |+| --- | --- | --- | --- | --- |+| floor | 291684 | 0.1015 (0.0884) | 50% | -0.0060 (-0.0061) |+| chrome sphere | 56296 | 0.2138 (0.1744) | 20% | +0.0199 (+0.0083) |+| copper box | 33196 | 0.2957 (0.3007) | 17% | -0.0591 (-0.0641) |+| gold torus | 20188 | 0.2109 (0.2234) | 7% | -0.0300 (-0.0292) |+| steel cylinder | 6636 | 0.3069 (0.2039) | 3% | -0.0531 (-0.0345) |+| background | 110400 | 0.0158 (0.0101) | 3% | -0.0003 |++The rough metals (copper, gold, steel) were darker than Cycles by 0.03 to 0.06 in both 67js and EEVEE. The environment specular was the single scattering split sum: `base reflectance * scale + offset`, which loses the light a rough GGX surface bounces a second time, while Cycles' Principled BSDF defaults to multiscatter GGX. `environmentLighting` now divides by `1 - (1 - scale - offset) * averageFresnel` (the closed form of Fdez-Aguera 2019, with the average Fresnel `F0 + (1 - F0) / 21`). Nothing is added to the BRDF lookup, so the extra cost is a few multiplies.++| Scene | before | after |+| --- | --- | --- |+| `metal` | 0.1036 (EEVEE 0.0916) | 0.0974 |+| `material-spheres` | 0.1286 (EEVEE 0.1053) | 0.1234 |+| `car-paint` | 0.1037 | 0.1030 |+| `foliage` | 0.0990 | 0.0981 |+| `mountain-valley` | 0.1782 | 0.1769 |+| `brushed-film` | 0.1029 | 0.1027 |++Every other scene moves by 0.0006 or less, none worse than 0.0002. Per region after the change: copper 0.2289 (was 0.2957), gold 0.1963 (was 0.2109), steel 0.3003, chrome 0.2127, floor 0.0994. Copper and gold are now past EEVEE; the remaining gap to EEVEE (0.0058) sits in the floor (50% of the error, 0.0994 against 0.0884: light bounced from the metal parts onto it, which the earlier one bounce probe test did not fix), the chrome sphere (0.021 too bright) and the steel cylinder. The direct light specular (`illuminate`) has no multiple scattering yet; it needs the BRDF lookup in the per light path, so it is the next thing to measure. Box 1 of #167 (metal reaches EEVEE) stays open.diff --git a/bench/reference/baseline.json b/bench/reference/baseline.jsonindex d5a79061..b93e49f0 100644--- a/bench/reference/baseline.json+++ b/bench/reference/baseline.json@@ -43,7 +43,7 @@"eevee": 0.9},"foliage": {- "cycles": 5,+ "cycles": 5.0,"eevee": 0.4},"glass": {@@ -71,7 +71,7 @@"eevee": 0.7},"metal-room": {- "cycles": 9,+ "cycles": 9.0,"eevee": 0.3},"metal": {@@ -91,7 +91,7 @@"eevee": 0.3},"temple-hall": {- "cycles": 16,+ "cycles": 16.0,"eevee": 0.8}},@@ -102,57 +102,57 @@"scores": {"brick-flat": {"gpu-vs-cycles": 0.1267,- "gpu-vs-eevee": 0.0466,+ "gpu-vs-eevee": 0.047,"cpu-vs-cycles": 0.1264,- "cpu-vs-eevee": 0.0463,+ "cpu-vs-eevee": 0.0466,"eevee-vs-cycles": 0.1099,"gpu-vs-cpu": 0.0066},"brick-graph": {- "gpu-vs-cycles": 0.1585,- "gpu-vs-eevee": 0.0868,- "cpu-vs-cycles": 0.1585,- "cpu-vs-eevee": 0.0869,+ "gpu-vs-cycles": 0.1587,+ "gpu-vs-eevee": 0.0874,+ "cpu-vs-cycles": 0.1586,+ "cpu-vs-eevee": 0.0876,"eevee-vs-cycles": 0.1221,"gpu-vs-cpu": 0.0078},"brick-room": {"gpu-vs-cycles": 0.5102,- "gpu-vs-eevee": 0.071,- "cpu-vs-cycles": 0.5096,- "cpu-vs-eevee": 0.0713,+ "gpu-vs-eevee": 0.0711,+ "cpu-vs-cycles": 0.5095,+ "cpu-vs-eevee": 0.0714,"eevee-vs-cycles": 0.502,"gpu-vs-cpu": 0.0071},"brushed-film": {- "gpu-vs-cycles": 0.1029,- "gpu-vs-eevee": 0.0855,+ "gpu-vs-cycles": 0.1027,+ "gpu-vs-eevee": 0.0844,"cpu-vs-cycles": 0.1026,- "cpu-vs-eevee": 0.0855,+ "cpu-vs-eevee": 0.0845,"eevee-vs-cycles": 0.0985,- "gpu-vs-cpu": 0.0062+ "gpu-vs-cpu": 0.0061},"car-paint": {- "gpu-vs-cycles": 0.1037,- "gpu-vs-eevee": 0.0649,- "cpu-vs-cycles": 0.1034,- "cpu-vs-eevee": 0.0649,+ "gpu-vs-cycles": 0.103,+ "gpu-vs-eevee": 0.0645,+ "cpu-vs-cycles": 0.1028,+ "cpu-vs-eevee": 0.0646,"eevee-vs-cycles": 0.0844,"gpu-vs-cpu": 0.0058},"character": {- "gpu-vs-cycles": 0.0717,- "gpu-vs-eevee": 0.0444,- "cpu-vs-cycles": 0.0714,- "cpu-vs-eevee": 0.0443,+ "gpu-vs-cycles": 0.0715,+ "gpu-vs-eevee": 0.0445,+ "cpu-vs-cycles": 0.0712,+ "cpu-vs-eevee": 0.0445,"eevee-vs-cycles": 0.0622,"gpu-vs-cpu": 0.0065},"dark-shaft": {- "gpu-vs-cycles": 0.0558,- "gpu-vs-eevee": 0.2639,+ "gpu-vs-cycles": 0.0559,+ "gpu-vs-eevee": 0.2638,"cpu-vs-cycles": 0.0559,- "cpu-vs-eevee": 0.2637,+ "cpu-vs-eevee": 0.2636,"eevee-vs-cycles": 0.2654,"gpu-vs-cpu": 0.003,"region-pixels": 0.0989,@@ -170,123 +170,123 @@},"fog-room": {"gpu-vs-cycles": 0.1036,- "gpu-vs-eevee": 0.3636,+ "gpu-vs-eevee": 0.3635,"cpu-vs-cycles": 0.1036,"cpu-vs-eevee": 0.3631,"eevee-vs-cycles": 0.373,"gpu-vs-cpu": 0.0065,"region-pixels": 0.2428,- "region-gpu-vs-cycles": 0.1615,+ "region-gpu-vs-cycles": 0.1614,"region-gpu-vs-eevee": 0.3273,"region-eevee-vs-cycles": 0.3147},"fog-valley": {- "gpu-vs-cycles": 0.1856,- "gpu-vs-eevee": 0.1444,- "cpu-vs-cycles": 0.1858,- "cpu-vs-eevee": 0.1448,+ "gpu-vs-cycles": 0.1855,+ "gpu-vs-eevee": 0.1456,+ "cpu-vs-cycles": 0.1857,+ "cpu-vs-eevee": 0.146,"eevee-vs-cycles": 0.1952,"gpu-vs-cpu": 0.0116},"foliage": {- "gpu-vs-cycles": 0.099,- "gpu-vs-eevee": 0.0809,- "cpu-vs-cycles": 0.0986,- "cpu-vs-eevee": 0.0806,+ "gpu-vs-cycles": 0.0981,+ "gpu-vs-eevee": 0.0806,+ "cpu-vs-cycles": 0.0978,+ "cpu-vs-eevee": 0.0803,"eevee-vs-cycles": 0.0888,- "gpu-vs-cpu": 0.0097+ "gpu-vs-cpu": 0.0095},"glass": {- "gpu-vs-cycles": 0.1035,- "gpu-vs-eevee": 0.0998,- "cpu-vs-cycles": 0.1035,- "cpu-vs-eevee": 0.1001,+ "gpu-vs-cycles": 0.1033,+ "gpu-vs-eevee": 0.1,+ "cpu-vs-cycles": 0.1033,+ "cpu-vs-eevee": 0.1002,"eevee-vs-cycles": 0.1008,- "gpu-vs-cpu": 0.0082+ "gpu-vs-cpu": 0.0081},"light-linking": {"gpu-vs-cycles": 0.0998,"gpu-vs-eevee": 0.1122,"cpu-vs-cycles": 0.0993,- "cpu-vs-eevee": 0.1127,+ "cpu-vs-eevee": 0.1128,"eevee-vs-cycles": 0.1558,"gpu-vs-cpu": 0.0027},"lit-interior": {- "gpu-vs-cycles": 0.5055,+ "gpu-vs-cycles": 0.5054,"gpu-vs-eevee": 0.0923,- "cpu-vs-cycles": 0.5051,- "cpu-vs-eevee": 0.0928,+ "cpu-vs-cycles": 0.505,+ "cpu-vs-eevee": 0.0929,"eevee-vs-cycles": 0.5159,"gpu-vs-cpu": 0.0062},"long-street": {- "gpu-vs-cycles": 0.1152,- "gpu-vs-eevee": 0.0907,- "cpu-vs-cycles": 0.1153,- "cpu-vs-eevee": 0.091,+ "gpu-vs-cycles": 0.1153,+ "gpu-vs-eevee": 0.0909,+ "cpu-vs-cycles": 0.1155,+ "cpu-vs-eevee": 0.0914,"eevee-vs-cycles": 0.0976,- "gpu-vs-cpu": 0.007+ "gpu-vs-cpu": 0.0062},"material-spheres": {- "gpu-vs-cycles": 0.1286,- "gpu-vs-eevee": 0.0749,- "cpu-vs-cycles": 0.1284,- "cpu-vs-eevee": 0.0747,+ "gpu-vs-cycles": 0.1234,+ "gpu-vs-eevee": 0.0723,+ "cpu-vs-cycles": 0.1233,+ "cpu-vs-eevee": 0.0722,"eevee-vs-cycles": 0.1053,- "gpu-vs-cpu": 0.0069+ "gpu-vs-cpu": 0.0073},"megacity-dusk": {- "gpu-vs-cycles": 0.1594,- "gpu-vs-eevee": 0.1025,- "cpu-vs-cycles": 0.1587,- "cpu-vs-eevee": 0.1063,+ "gpu-vs-cycles": 0.1589,+ "gpu-vs-eevee": 0.1034,+ "cpu-vs-cycles": 0.1582,+ "cpu-vs-eevee": 0.1072,"eevee-vs-cycles": 0.1524,"gpu-vs-cpu": 0.0276},"metal": {- "gpu-vs-cycles": 0.1036,- "gpu-vs-eevee": 0.0781,- "cpu-vs-cycles": 0.1033,- "cpu-vs-eevee": 0.0782,+ "gpu-vs-cycles": 0.0974,+ "gpu-vs-eevee": 0.0813,+ "cpu-vs-cycles": 0.0972,+ "cpu-vs-eevee": 0.0815,"eevee-vs-cycles": 0.0916,"gpu-vs-cpu": 0.0064},"metal-room": {- "gpu-vs-cycles": 0.5076,- "gpu-vs-eevee": 0.1082,- "cpu-vs-cycles": 0.5072,- "cpu-vs-eevee": 0.1088,+ "gpu-vs-cycles": 0.5074,+ "gpu-vs-eevee": 0.1085,+ "cpu-vs-cycles": 0.507,+ "cpu-vs-eevee": 0.1091,"eevee-vs-cycles": 0.5262,"gpu-vs-cpu": 0.0062},"mountain-valley": {- "gpu-vs-cycles": 0.1782,- "gpu-vs-eevee": 0.2683,- "cpu-vs-cycles": 0.1755,- "cpu-vs-eevee": 0.2667,+ "gpu-vs-cycles": 0.1769,+ "gpu-vs-eevee": 0.2671,+ "cpu-vs-cycles": 0.1743,+ "cpu-vs-eevee": 0.2655,"eevee-vs-cycles": 0.1893,"gpu-vs-cpu": 0.0124},"outdoor-hdri": {- "gpu-vs-cycles": 0.0451,- "gpu-vs-eevee": 0.0282,- "cpu-vs-cycles": 0.0445,- "cpu-vs-eevee": 0.0279,+ "gpu-vs-cycles": 0.0445,+ "gpu-vs-eevee": 0.0283,+ "cpu-vs-cycles": 0.0439,+ "cpu-vs-eevee": 0.0281,"eevee-vs-cycles": 0.0403,- "gpu-vs-cpu": 0.0065+ "gpu-vs-cpu": 0.0062},"spot-area": {"gpu-vs-cycles": 0.1242,"gpu-vs-eevee": 0.1707,"cpu-vs-cycles": 0.1242,- "cpu-vs-eevee": 0.1709,+ "cpu-vs-eevee": 0.171,"eevee-vs-cycles": 0.1935,"gpu-vs-cpu": 0.0032},"temple-hall": {"gpu-vs-cycles": 0.064,- "gpu-vs-eevee": 0.232,+ "gpu-vs-eevee": 0.2319,"cpu-vs-cycles": 0.064,"cpu-vs-eevee": 0.2318,"eevee-vs-cycles": 0.2341,diff --git a/bench/reference/images/brick-flat.jpg b/bench/reference/images/brick-flat.jpgindex 3d0c75a2..e20a1856 100644Binary files a/bench/reference/images/brick-flat.jpg and b/bench/reference/images/brick-flat.jpg differdiff --git a/bench/reference/images/brick-graph.jpg b/bench/reference/images/brick-graph.jpgindex c76eebbf..037f8b2a 100644Binary files a/bench/reference/images/brick-graph.jpg and b/bench/reference/images/brick-graph.jpg differdiff --git a/bench/reference/images/brick-room.jpg b/bench/reference/images/brick-room.jpgindex b248c60b..84cd28b2 100644Binary files a/bench/reference/images/brick-room.jpg and b/bench/reference/images/brick-room.jpg differdiff --git a/bench/reference/images/brushed-film.jpg b/bench/reference/images/brushed-film.jpgindex f9e71bb7..0e7d71f1 100644Binary files a/bench/reference/images/brushed-film.jpg and b/bench/reference/images/brushed-film.jpg differdiff --git a/bench/reference/images/car-paint.jpg b/bench/reference/images/car-paint.jpgindex 4634472c..2260a6cc 100644Binary files a/bench/reference/images/car-paint.jpg and b/bench/reference/images/car-paint.jpg differdiff --git a/bench/reference/images/character.jpg b/bench/reference/images/character.jpgindex 71459c86..7b1f085c 100644Binary files a/bench/reference/images/character.jpg and b/bench/reference/images/character.jpg differdiff --git a/bench/reference/images/dark-shaft.jpg b/bench/reference/images/dark-shaft.jpgindex 0722147e..6e0350cb 100644Binary files a/bench/reference/images/dark-shaft.jpg and b/bench/reference/images/dark-shaft.jpg differdiff --git a/bench/reference/images/fog-room.jpg b/bench/reference/images/fog-room.jpgindex 32fe6af5..51cb92c2 100644Binary files a/bench/reference/images/fog-room.jpg and b/bench/reference/images/fog-room.jpg differdiff --git a/bench/reference/images/fog-valley.jpg b/bench/reference/images/fog-valley.jpgindex 78ed7f84..ba71797a 100644Binary files a/bench/reference/images/fog-valley.jpg and b/bench/reference/images/fog-valley.jpg differdiff --git a/bench/reference/images/fog.jpg b/bench/reference/images/fog.jpgindex b7debfb8..36e441b6 100644Binary files a/bench/reference/images/fog.jpg and b/bench/reference/images/fog.jpg differdiff --git a/bench/reference/images/foliage.jpg b/bench/reference/images/foliage.jpgindex 237744b5..f8f42709 100644Binary files a/bench/reference/images/foliage.jpg and b/bench/reference/images/foliage.jpg differdiff --git a/bench/reference/images/glass.jpg b/bench/reference/images/glass.jpgindex e8b09263..e0eca2ce 100644Binary files a/bench/reference/images/glass.jpg and b/bench/reference/images/glass.jpg differdiff --git a/bench/reference/images/light-linking.jpg b/bench/reference/images/light-linking.jpgindex 8e6a7d86..3d81593f 100644Binary files a/bench/reference/images/light-linking.jpg and b/bench/reference/images/light-linking.jpg differdiff --git a/bench/reference/images/lit-interior.jpg b/bench/reference/images/lit-interior.jpgindex 7bba6028..441c670c 100644Binary files a/bench/reference/images/lit-interior.jpg and b/bench/reference/images/lit-interior.jpg differdiff --git a/bench/reference/images/long-street.jpg b/bench/reference/images/long-street.jpgindex 4a397fe9..1413a380 100644Binary files a/bench/reference/images/long-street.jpg and b/bench/reference/images/long-street.jpg differdiff --git a/bench/reference/images/material-spheres.jpg b/bench/reference/images/material-spheres.jpgindex d04ac5af..7797f15c 100644Binary files a/bench/reference/images/material-spheres.jpg and b/bench/reference/images/material-spheres.jpg differdiff --git a/bench/reference/images/megacity-dusk.jpg b/bench/reference/images/megacity-dusk.jpgindex 32d7c336..636a8309 100644Binary files a/bench/reference/images/megacity-dusk.jpg and b/bench/reference/images/megacity-dusk.jpg differdiff --git a/bench/reference/images/metal-room.jpg b/bench/reference/images/metal-room.jpgindex 8eed5114..fc6dd5aa 100644Binary files a/bench/reference/images/metal-room.jpg and b/bench/reference/images/metal-room.jpg differdiff --git a/bench/reference/images/metal.jpg b/bench/reference/images/metal.jpgindex 17d74ec0..077c58b9 100644Binary files a/bench/reference/images/metal.jpg and b/bench/reference/images/metal.jpg differdiff --git a/bench/reference/images/mountain-valley.jpg b/bench/reference/images/mountain-valley.jpgindex c699c48a..204e0541 100644Binary files a/bench/reference/images/mountain-valley.jpg and b/bench/reference/images/mountain-valley.jpg differdiff --git a/bench/reference/images/outdoor-hdri.jpg b/bench/reference/images/outdoor-hdri.jpgindex cddd474b..3279cf94 100644Binary files a/bench/reference/images/outdoor-hdri.jpg and b/bench/reference/images/outdoor-hdri.jpg differdiff --git a/bench/reference/images/spot-area.jpg b/bench/reference/images/spot-area.jpgindex b57442bd..6d796583 100644Binary files a/bench/reference/images/spot-area.jpg and b/bench/reference/images/spot-area.jpg differdiff --git a/bench/reference/images/temple-hall.jpg b/bench/reference/images/temple-hall.jpgindex e949650c..45e56fe8 100644Binary files a/bench/reference/images/temple-hall.jpg and b/bench/reference/images/temple-hall.jpg differdiff --git a/bench/size/budgets.json b/bench/size/budgets.jsonindex 86fb0e17..4985ddf9 100644--- a/bench/size/budgets.json+++ b/bench/size/budgets.json@@ -44,10 +44,10 @@"entry:material-layer-shaders": 20700,"entry:light-linking": 19000,"entry:cascaded-shadows": 27700,- "scene:lit-box": 63000,+ "scene:lit-box": 63050,"scene:gltf-box": 84200,"scene:gltf-box+lazy": 87600,- "scene:agent-scene": 104800,- "scene:agent-scene+lazy": 286700+ "scene:agent-scene": 104840,+ "scene:agent-scene+lazy": 286760}}diff --git a/changes/167.md b/changes/167.mdnew file mode 100644index 00000000..62df58a6--- /dev/null+++ b/changes/167.md@@ -0,0 +1 @@+- Add multiple scattering to the environment specular (part of issue #167). `environmentLighting` in `src/environment.js` adds the energy a rough microfacet surface bounces a second time (Fdez-Aguera 2019), as Cycles' multiscatter GGX does, so rough metals are no longer dark: `metal` goes from 0.1036 to 0.0974 against Cycles (EEVEE 0.0916). See `bench/reference/README.md`.diff --git a/src/environment.js b/src/environment.jsindex 6f58baa7..111af7ed 100644--- a/src/environment.js+++ b/src/environment.js@@ -269,6 +269,7 @@ vec3 environmentRadiance(vec3 direction, float level) {}`;+// environmentLighting adds back the light a rough microfacet surface bounces a second time, as Cycles' multiscatter GGX does (Fdez-Aguera 2019).export const environmentShadingGlsl = `uniform sampler2D environmentBrdf;uniform float environmentEnabled;@@ -290,7 +291,10 @@ vec3 environmentDiffuse(vec3 normal) {vec3 environmentLighting(vec3 normal, vec3 specularNormal, vec3 baseReflectance, vec3 viewDirection, vec3 color, float metallic, float roughness, float occlusion, float ambient, float specularWeight) {float normalView = clamp(dot(normal, viewDirection), 0.001, 1.0);vec2 lookup = texture(environmentBrdf, vec2(normalView, roughness)).rg;- vec3 specularColor = (baseReflectance * lookup.x + lookup.y) * specularWeight;+ vec3 singleScatter = baseReflectance * lookup.x + lookup.y;+ float missingEnergy = 1.0 - (lookup.x + lookup.y);+ vec3 averageFresnel = baseReflectance + (1.0 - baseReflectance) / 21.0;+ vec3 specularColor = singleScatter / (1.0 - missingEnergy * averageFresnel) * specularWeight;vec3 specular = environmentRadiance(reflect(-viewDirection, specularNormal), roughness * environmentLevelMax) * specularColor;vec3 diffuse = environmentDiffuse(normal) * color * (1.0 - metallic) * (1.0 - specularColor);return (specular + diffuse) * occlusion * ambient;diff --git a/tests/environment.test.js b/tests/environment.test.jsindex c8afd3bd..a58fb191 100644--- a/tests/environment.test.js+++ b/tests/environment.test.js@@ -1,6 +1,6 @@import test from 'node:test';import assert from 'node:assert/strict';-import { createEnvironmentMap, computeIrradianceCoefficients, evaluateIrradiance, estimateEnvironmentBytes, environmentSpecularLayout, ENVIRONMENT_BRDF_SIZE } from '../src/environment.js';+import { createEnvironmentMap, computeIrradianceCoefficients, evaluateIrradiance, estimateEnvironmentBytes, environmentSpecularLayout, ENVIRONMENT_BRDF_SIZE, environmentShadingGlsl } from '../src/environment.js';import { parseRadianceHdr, loadHdri } from '../src/hdri.js';function filledMap(width, height, fillPixel, extra = {}) {@@ -120,3 +120,8 @@ test('environment memory accounting counts the half-float chain and the BRDF looassert.equal(environmentSpecularLayout(small).levelCount, 5);assert.throws(() => estimateEnvironmentBytes({ ...small, data: new Float32Array(3) }, 4096), /data length/);});++test('environment specular adds the energy a rough surface scatters a second time', () => {+ assert.match(environmentShadingGlsl, /missingEnergy/);+ assert.match(environmentShadingGlsl, /singleScatter \/ \(1\.0 - missingEnergy \* averageFresnel\)/);+});