3D engine that AI agents drive
Add volumeFog shadowAmbient so open ground keeps its sky light in shadow (part of #165)
Nguyen Xuan Ane2b1f9d7c007
diff --git a/bench/reference/README.md b/bench/reference/README.mdindex b740d04b..9f1de051 100644--- a/bench/reference/README.md+++ b/bench/reference/README.md@@ -599,3 +599,29 @@ Method: Cycles was rendered a second time with the world light at 0 (sun only) f- Valley floor: the cause is mostly not sky visibility. In Cycles the sun does not reach the floor at all (0.0003): the sun is 13 degrees above the horizon behind a rim up to 1,100 m high. In 67js the floor takes 0.0251 from the sun, in stripes along the sun direction and with no tree shadows, which is 54 percent of the 0.0466 gap. The other 0.0215 is sky light (0.0866 against 0.0648).- Terrain sky visibility did read a little high. A brute-force march (48 azimuths, 8 m first step, 8 percent growth) gives 0.68 to 0.69 on the floor and `terrain-sky.js` gave 0.73, because the 1.3 step growth skips narrow peaks. A step growth of 1.1 gives 0.694 at about 0.03 s more build time. It moved the floor from 0.1117 to 0.1073 (nearer Cycles), but the slopes from 0.0258 to 0.0232 (further from Cycles 0.0394), and `mountain-valley` went from 0.2623 to 0.2743 against Cycles. Reverted. The slopes are already darker than Cycles, which has bounced light off the lit walls.- The sky radiance by elevation of the capped HDRI is nearly flat (the share of irradiance above a 40 degree horizon is 0.70 against 0.59 for a uniform sky), so a sky that is brighter near the horizon does not explain the floor.++## Fog valley against EEVEE (2026-11-03, part of issue #165)++`fog-valley` scored 0.1967 against EEVEE's 0.1952. Measured by band of rows on the GPU render (FLIP against Cycles): 67js is better than EEVEE in the sky (0.1311 against 0.1608, and 0.0512 against 0.0815 within 40 pixels of the sun, so the glow is not the problem), and worse below the horizon (0.2437 against 0.2317 at rows 230 to 300, 0.2664 against 0.2576 at rows 300 to 400) and in the left third of the frame (0.2866 against 0.2556), where the shadowed face of the near tower and the ground shadow are darker than in Cycles. The fog's in-scatter inside the sun's shadow is the term that lifts them, and it keeps 15 percent of the ambient there, a constant fitted to closed rooms, where the air in shadow sees walls and not sky.++Single constants tried on the GPU render of the five fog scenes (the whole frame against Cycles, before: `fog-valley` 0.1967, `fog-room` 0.1049, `dark-shaft` 0.0619, `temple-hall` 0.0659, `fog` 0.2257):++| Change | `fog-valley` | `fog-room` | `dark-shaft` | `temple-hall` | `fog` |+| --- | --- | --- | --- | --- | --- |+| shadow floor 0.4 | 0.1915 | 0.1473 | 0.0637 | 0.0772 | 0.2252 |+| glow weight 0.02 | 0.2073 | 0.0978 | 0.0586 | 0.0655 | 0.1951 |+| glow weight 0.004 | 0.1942 | 0.1093 | 0.0644 | 0.0735 | 0.2474 |+| glow only from pixels above 1.0, weight 0.02 | 0.2002 | 0.1144 | 0.0665 | 0.0722 | 0.2672 |++Every global value trades a room against the open ground. The floor is now the fog field `shadowAmbient` (default 0.15, so every recipe and scene keeps its picture), and `fog-valley` sets 1: open ground under a sky is lit by the whole sky in shadow too. On the GPU render the valley goes 0.1967, 0.1915 (floor 0.4), 0.1883 (0.6) and 0.1855 (1.0) as the floor rises; the 0.6 and 1.0 renders were measured with two runs overlapping, so only the 1.0 value is kept, and the full run below was made alone.++Full suite, `npm run reference -- --skip-blender` on the stored Cycles and EEVEE arrays (RTX 3060, GPU and CPU renders):++| Scene | Before | After |+| --- | --- | --- |+| `fog-valley` against Cycles (GPU) | 0.1967 | 0.1855 |+| `fog-valley` against Cycles (CPU) | 0.1965 | 0.1857 |+| EEVEE against Cycles | 0.1952 | 0.1952 |+| `fog-room`, `dark-shaft`, `temple-hall`, `fog` | 0.1049, 0.0619, 0.0659, 0.2257 | same to four digits |++No other score in `baseline.json` moved by more than 0.0004. `gpu-vs-cpu` of `fog-valley` is 0.0120, so the 0.0112 gain is about as large as that spread; both renderers agree on the direction, and the valley is now 0.0097 below EEVEE, which the spread does not cover.diff --git a/bench/reference/baseline.json b/bench/reference/baseline.jsonindex 1a9035f3..5e9cb9eb 100644--- a/bench/reference/baseline.json+++ b/bench/reference/baseline.json@@ -177,12 +177,12 @@"region-eevee-vs-cycles": 0.3146},"fog-valley": {- "gpu-vs-cycles": 0.1967,- "gpu-vs-eevee": 0.1098,- "cpu-vs-cycles": 0.1965,- "cpu-vs-eevee": 0.1095,+ "gpu-vs-cycles": 0.1855,+ "gpu-vs-eevee": 0.1443,+ "cpu-vs-cycles": 0.1857,+ "cpu-vs-eevee": 0.1447,"eevee-vs-cycles": 0.1952,- "gpu-vs-cpu": 0.0122+ "gpu-vs-cpu": 0.012},"foliage": {"gpu-vs-cycles": 0.1023,diff --git a/bench/reference/images/fog-valley.jpg b/bench/reference/images/fog-valley.jpgindex 80651359..7bf7e5f1 100644Binary files a/bench/reference/images/fog-valley.jpg and b/bench/reference/images/fog-valley.jpg differdiff --git a/bench/reference/scenes.js b/bench/reference/scenes.jsindex 6d11da2f..9c01b2eb 100644--- a/bench/reference/scenes.js+++ b/bench/reference/scenes.js@@ -455,7 +455,7 @@ async function fogValleyScene() {const lighting = await skyLighting();const volumeFog = {density: 0.005, minimum: [-300, 0, -450], maximum: [300, 90, 40],- color: [1, 1, 1], ambient: lighting.meanRadiance, anisotropy: 0.4, noiseAmount: 0, steps: 48, maxDistance: 600,+ color: [1, 1, 1], ambient: lighting.meanRadiance, shadowAmbient: 1, anisotropy: 0.4, noiseAmount: 0, steps: 48, maxDistance: 600,};return {parts, blenderWorld: lighting.blenderWorld,diff --git a/bench/tool-cost-budgets.json b/bench/tool-cost-budgets.jsonindex 28a84e08..f7d63083 100644--- a/bench/tool-cost-budgets.json+++ b/bench/tool-cost-budgets.json@@ -1,9 +1,9 @@{- "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494); reflection probes (issue #55): the bake.probes line, and the scene_capabilities result raised to 16600 (measured 16541) after merging with main",+ "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494); reflection probes (issue #55): the bake.probes line, and the scene_capabilities result raised to 16600 (measured 16541) after merging with main; volumeFog shadowAmbient (issue #165): scene_create raised to 62945 (measured 62940) and scene_apply to 45040 (measured 45037)","schemaTotalBytes": 190830,"schemaToolBytes": {- "scene_create": 62930,- "scene_apply": 45020,+ "scene_create": 62945,+ "scene_apply": 45040,"mesh_edit": 33980,"scene_create_asset": 19310,"mesh_stack": 11030diff --git a/changes/issue-165-fog-valley.md b/changes/issue-165-fog-valley.mdnew file mode 100644index 00000000..fde1a6ee--- /dev/null+++ b/changes/issue-165-fog-valley.md@@ -0,0 +1 @@+- Add `volumeFog.shadowAmbient` (0 to 1, default 0.15, the value that was hard coded in `src/post.js`): the share of the fog's `ambient` that stays where the sun's shadow covers it. A closed room sees little sky, so 0.15 holds and no existing recipe changes. Open ground under a sky sees all of it, so `fog-valley` sets 1 and goes from 0.1967 to 0.1855 against Cycles, past EEVEE's 0.1952 (part of issue #165). Measured on the glow weight and the shadow floor first: the glow weight lowered `fog-valley` only at the cost of `fog` (+0.02) and `temple-hall` (+0.008), and a global floor of 0.4 cost `fog-room` +0.04, so neither could be one constant for rooms and open ground.diff --git a/docs/agent-look.md b/docs/agent-look.mdindex 8511a84b..1de74e67 100644--- a/docs/agent-look.md+++ b/docs/agent-look.md@@ -179,6 +179,7 @@ These controls reuse `resolveVolumeFog` and its existing domain rules.| `noiseAmount` | `0.5` | `0` to `1` || `noiseScale` | `0.3` | `0.001` to `100` || `maxDistance` | `100` | `0.01` to `10000` |+| `shadowAmbient` | `0.15` | `0` to `1` |Fog bounds reject dimensions that collapse after Float32 rounding.The current volume supports one directional scattering source.diff --git a/docs/volumetric.md b/docs/volumetric.mdindex d66d5f0b..762971ec 100644--- a/docs/volumetric.md+++ b/docs/volumetric.md@@ -41,6 +41,7 @@ renderer.render({ eye: [0, 2, 5], target: [0, 1, 0], time: 0 });| `noiseScale` | `0.3` | `0.001…100`, inverse scene units || `drift` | `[0.03, 0, 0]` | Three components within ±100, scene units per second || `maxDistance` | `100` | `0.01…10,000`, ray distance in scene units |+| `shadowAmbient` | `0.15` | `0…1`; the share of `ambient` the fog keeps where the sun's shadow covers it. A closed room sees little sky (0.15); open ground under a sky sees all of it (1) |Values must be finite numbers. Active volume fog accepts finite frame time within ±1,000,000 seconds and a nonzero light direction with components within ±1,000,000. Noise samples absolute time, so backward seeks reproduce earlier density.diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjsindex 45a0a2e0..5b73bbc8 100644--- a/scripts/mcp-server.mjs+++ b/scripts/mcp-server.mjs@@ -141,6 +141,7 @@ const volumeFog = z.strictObject({noiseAmount: unit.optional(),noiseScale: bounded(0.001, 100).optional(),maxDistance: bounded(0.01, 1e4).optional(),+ shadowAmbient: unit.optional(),});const affects = z.array(z.string()).optional();const environment = z.strictObject({diff --git a/src/agent-look.js b/src/agent-look.jsindex b1281597..351ec037 100644--- a/src/agent-look.js+++ b/src/agent-look.js@@ -17,7 +17,7 @@ const POINT_LIGHT_FIELDS = ['position', 'color', 'intensity', 'radius', 'range',const SPOT_LIGHT_FIELDS = ['position', 'direction', 'angle', 'penumbra', 'color', 'intensity', 'radius', 'range', 'castShadow', 'affects'];const AREA_LIGHT_FIELDS = ['position', 'direction', 'up', 'width', 'height', 'color', 'intensity', 'affects'];const VOLUME_VECTOR_FIELDS = ['minimum', 'maximum', 'color', 'ambient', 'drift'];-const VOLUME_NUMBER_FIELDS = ['density', 'steps', 'anisotropy', 'noiseAmount', 'noiseScale', 'maxDistance'];+const VOLUME_NUMBER_FIELDS = ['density', 'steps', 'anisotropy', 'noiseAmount', 'noiseScale', 'maxDistance', 'shadowAmbient'];const BLOOM_FIELDS = ['strength', 'threshold', 'radius'];const DEPTH_OF_FIELD_FIELDS = ['blur', 'focusDistance'];const MOTION_BLUR_FIELDS = ['shutter'];diff --git a/src/post.js b/src/post.jsindex d8012c74..623a4806 100644--- a/src/post.js+++ b/src/post.js@@ -35,6 +35,7 @@ uniform vec3 volumeAmbient;uniform vec3 volumeDrift;uniform int volumeSteps;uniform float volumeAnisotropy;+uniform float volumeShadowAmbient;uniform float volumeNoiseAmount;uniform float volumeNoiseScale;uniform float volumeMaxDistance;@@ -136,7 +137,7 @@ vec3 volumeFog(vec3 background) {if (all(greaterThanEqual(shadow, vec3(0))) && all(lessThanEqual(shadow, vec3(1)))) {visibility = step(shadow.z - 0.0008, texture(volumeShadowMap, shadow.xy).r);}- vec3 scattering = volumeColor * (volumeAmbient * mix(0.15, 1.0, visibility) + volumeLightColor * phase * visibility);+ vec3 scattering = volumeColor * (volumeAmbient * mix(volumeShadowAmbient, 1.0, visibility) + volumeLightColor * phase * visibility);accumulated += transmittance * opacity * scattering;transmittance *= 1.0 - opacity;if (transmittance < 0.001) break;diff --git a/src/renderer.js b/src/renderer.jsindex f58811c5..b69f8050 100644--- a/src/renderer.js+++ b/src/renderer.js@@ -41,7 +41,7 @@ const DEFORMING_TAGS = new Set(['foliage', 'grass', 'water', 'fire', 'smoke']);// strength, so they can be culled and given levels like rigid parts.const SWAY_REACH_PER_STRENGTH = 0.56;-const POST_UNIFORMS = ['transparent', 'frameTexture', 'bloomTexture', 'bloomStrength', 'hdrEnabled', 'grade', 'vignette', 'grainAmount', 'resolution', 'monochrome', 'fade', 'cinematic', 'time', 'volumeExplosion', 'explosionProgress', 'inverseViewProjection', 'eye', 'sceneDepth', 'volumeShadowMap', 'volumeLightProjection', 'volumeLightDirection', 'volumeLightColor', 'volumeDensity', 'volumeMinimum', 'volumeMaximum', 'volumeColor', 'volumeAmbient', 'volumeDrift', 'volumeSteps', 'volumeAnisotropy', 'volumeNoiseAmount', 'volumeNoiseScale', 'volumeMaxDistance', 'orthographic', 'occlusionTexture', 'occlusionStrength', 'occlusionTexel'];+const POST_UNIFORMS = ['transparent', 'frameTexture', 'bloomTexture', 'bloomStrength', 'hdrEnabled', 'grade', 'vignette', 'grainAmount', 'resolution', 'monochrome', 'fade', 'cinematic', 'time', 'volumeExplosion', 'explosionProgress', 'inverseViewProjection', 'eye', 'sceneDepth', 'volumeShadowMap', 'volumeLightProjection', 'volumeLightDirection', 'volumeLightColor', 'volumeDensity', 'volumeMinimum', 'volumeMaximum', 'volumeColor', 'volumeAmbient', 'volumeDrift', 'volumeSteps', 'volumeAnisotropy', 'volumeShadowAmbient', 'volumeNoiseAmount', 'volumeNoiseScale', 'volumeMaxDistance', 'orthographic', 'occlusionTexture', 'occlusionStrength', 'occlusionTexel'];function postUniformLocations(context, program) {return Object.fromEntries(POST_UNIFORMS.map(name => [name, context.getUniformLocation(program, name)]));@@ -1683,6 +1683,7 @@ export class Renderer67 {context.uniform3fv(post.uniforms.volumeDrift, volume.drift);context.uniform1i(post.uniforms.volumeSteps, volume.steps);context.uniform1f(post.uniforms.volumeAnisotropy, volume.anisotropy);+ context.uniform1f(post.uniforms.volumeShadowAmbient, volume.shadowAmbient);context.uniform1f(post.uniforms.volumeNoiseAmount, volume.noiseAmount);context.uniform1f(post.uniforms.volumeNoiseScale, volume.noiseScale);context.uniform1f(post.uniforms.volumeMaxDistance, volume.maxDistance);diff --git a/src/volumetric.js b/src/volumetric.jsindex 4cece408..3b03194a 100644--- a/src/volumetric.js+++ b/src/volumetric.js@@ -34,5 +34,6 @@ export function resolveVolumeFog(input = {}) {const noiseAmount = finiteRange(input.noiseAmount ?? 0.5, 0, 1, 'Volume noise amount');const noiseScale = finiteRange(input.noiseScale ?? 0.3, 0.001, 100, 'Volume noise scale');const maxDistance = finiteRange(input.maxDistance ?? 100, 0.01, 1e4, 'Volume maximum distance');- return { density, minimum, maximum, color, ambient, drift, steps, anisotropy, noiseAmount, noiseScale, maxDistance };+ const shadowAmbient = finiteRange(input.shadowAmbient ?? 0.15, 0, 1, 'Volume shadow ambient');+ return { density, minimum, maximum, color, ambient, drift, steps, anisotropy, noiseAmount, noiseScale, maxDistance, shadowAmbient };}diff --git a/tests/volumetric.test.js b/tests/volumetric.test.jsindex f85df1ec..449d9e9b 100644--- a/tests/volumetric.test.js+++ b/tests/volumetric.test.js@@ -14,9 +14,15 @@ test('bounded volume controls default disabled and preserve ordinary input data'});test('volume preflight rejects malformed controls and Float32 collapsed bounds', () => {- for (const input of [null, [], { density: -1 }, { density: Infinity }, { steps: 7 }, { steps: 12.5 }, { noiseScale: 0 }, { noiseAmount: 1.01 }, { anisotropy: 1 }, { minimum: [1e5, 0, 0], maximum: [1e5 + 1e-8, 1, 1] }, { color: [1, NaN, 1] }, { drift: [0, '1', 0] }]) {+ for (const input of [null, [], { density: -1 }, { density: Infinity }, { steps: 7 }, { steps: 12.5 }, { noiseScale: 0 }, { noiseAmount: 1.01 }, { anisotropy: 1 }, { minimum: [1e5, 0, 0], maximum: [1e5 + 1e-8, 1, 1] }, { color: [1, NaN, 1] }, { drift: [0, '1', 0] }, { shadowAmbient: -0.1 }, { shadowAmbient: 1.1 }]) {assert.throws(() => resolveVolumeFog(input));}assert.throws(() => new Renderer67({}, [], { hdr: true, environment: { volumeFog: { density: 0.1 } } }), /depth:true/);assert.throws(() => new Renderer67({}, [], { hdr: true, depth: true, transparent: true, environment: { volumeFog: { density: 0.1 } } }), /opaque/);});++test('volume shadow ambient defaults to the closed room share and accepts the full range', () => {+ assert.equal(resolveVolumeFog({ density: 0.1 }).shadowAmbient, 0.15);+ assert.equal(resolveVolumeFog({ density: 0.1, shadowAmbient: 1 }).shadowAmbient, 1);+ assert.equal(resolveVolumeFog({ density: 0.1, shadowAmbient: 0 }).shadowAmbient, 0);+});