Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Trace emissive maps and volume fog in the path tracer (issue #284)

Nguyen Xuan Anfdcfc7d07610
diff --git a/bench/reference/README.md b/bench/reference/README.md
index 91ce5ffc..821b16b2 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -588,6 +588,8 @@ Path tracer (issue #57): `npm run reference -- --path-tracer [--samples 32]` dra
The tracer is worse than the rasterizer on `outdoor-hdri` and `character`: in the images the floor is darker than in Cycles (the cause is not found), and `fog` shows the missing volume. The denoiser blurs some soft shadows. Cycles used 256 samples. See `docs/path-tracer.md` for what the tracer draws and skips.
+Path tracer, emissive maps and fog (issue #284, 2026-11-03, 64 samples, one run each, shared machine): `fog` goes from 0.5333 to 0.0312 against Cycles now that the tracer draws the volume (the rasterizer scores 0.2021), in 85.3 s. The new scene `emissive-sign` is a dark wall with a panel whose `emissiveMap` is a strip of colour bars with scan lines, over a pale floor under a faint sky; `render-blender.py` multiplies the panel's emissive colour by the same map (`add_emissive_map`). The path tracer scores 0.0800 (62.9 s) and the rasterizer 0.2372, since the rasterizer does not light the floor from the panel. The rasterizer figure was taken with `--scene emissive-sign --skip-cpu` and scored on the GPU render alone, so `baseline.json` has no row for the scene yet; `path-tracer.json` was merged by hand with the other 15 scenes unchanged.
+
Path tracer, second pass (issue #129, 2026-11-01): 64 samples at most, `noiseThreshold` 0.03, four threads, 960 by 540; seconds are wall time and include scene setup. The scores are in "Scores now".
`light-linking` scores 0.0213 against Cycles, ahead of the rasterizer (0.0998): the tracer honours light linking, so a light adds nothing at a part it skips.
diff --git a/bench/reference/__pycache__/score.cpython-312.pyc b/bench/reference/__pycache__/score.cpython-312.pyc
new file mode 100644
index 00000000..450c7745
Binary files /dev/null and b/bench/reference/__pycache__/score.cpython-312.pyc differ
diff --git a/bench/reference/path-tracer.json b/bench/reference/path-tracer.json
index 36bec2d6..847ac4a0 100644
--- a/bench/reference/path-tracer.json
+++ b/bench/reference/path-tracer.json
@@ -45,13 +45,20 @@
"gltf materials are traced as plain surfaces."
]
},
+ "emissive-sign": {
+ "pathtracer-vs-cycles": 0.08,
+ "seconds": 62.9,
+ "samples": 64,
+ "averageSamples": 64,
+ "ignored": []
+ },
"fog": {
- "pathtracer-vs-cycles": 0.5333,
- "seconds": 24.1,
+ "pathtracer-vs-cycles": 0.0312,
+ "seconds": 85.3,
"samples": 64,
"averageSamples": 64,
"ignored": [
- "volumeFog is not traced."
+ "volumeFog.ambient is not added: the fog is lit by the traced lights and sky."
]
},
"foliage": {
diff --git a/bench/reference/render-blender.py b/bench/reference/render-blender.py
index 3a336665..053f18e7 100644
--- a/bench/reference/render-blender.py
+++ b/bench/reference/render-blender.py
@@ -136,6 +136,20 @@ def add_texture(material, principled, description, has_vertex_colors):
links.new(cutoff.outputs[0], principled.inputs["Alpha"])
+def add_emissive_map(material, principled, description, emission_color):
+ """67js multiplies the emissive colour and strength by the emissive map (sRGB), so the map drives the Emission Color socket."""
+ nodes = material.node_tree.nodes
+ links = material.node_tree.links
+ texture = nodes.new("ShaderNodeTexImage")
+ texture.image = build_image(f"{material.name}-emissive", description["emissiveMap"])
+ multiply = nodes.new("ShaderNodeMixRGB")
+ multiply.blend_type = "MULTIPLY"
+ multiply.inputs[0].default_value = 1
+ set_linear_color(multiply.inputs[2], emission_color)
+ links.new(texture.outputs["Color"], multiply.inputs[1])
+ links.new(multiply.outputs["Color"], principled.inputs["Emission Color"])
+
+
def add_vertex_colors(material, principled, description):
nodes = material.node_tree.nodes
links = material.node_tree.links
@@ -501,6 +515,8 @@ def build_material(name, description, has_vertex_colors):
emission_color = description.get("emissiveColor", description["color"])
set_linear_color(principled.inputs["Emission Color"], emission_color)
principled.inputs["Emission Strength"].default_value = description["emission"]
+ if "emissiveMap" in description:
+ add_emissive_map(material, principled, description, emission_color)
if "graph" in description:
add_graph(material, principled, description)
elif "map" in description:
diff --git a/bench/reference/scenes.js b/bench/reference/scenes.js
index 6e6fe848..56d4bcc4 100644
--- a/bench/reference/scenes.js
+++ b/bench/reference/scenes.js
@@ -615,7 +615,45 @@ async function megacityDuskScene() {
};
}
+// A lit sign at night (issue #284): a dark wall with a panel whose emissive map is a strip of colour bars with a scan line
+// pattern, over a pale floor under a faint constant sky. The panel is the only strong light, so the colours must come from
+// the map and the floor in front of it must pick up its glow.
+const SIGN_MAP_WIDTH = 32;
+const SIGN_MAP_HEIGHT = 16;
+const SIGN_BAR_COLORS = [[255, 255, 255], [255, 210, 40], [40, 220, 230], [60, 230, 70], [240, 60, 220], [240, 50, 40], [50, 70, 240], [20, 20, 20]];
+
+function signEmissiveImage() {
+ const pixels = new Uint8ClampedArray(SIGN_MAP_WIDTH * SIGN_MAP_HEIGHT * 4);
+ for (let row = 0; row < SIGN_MAP_HEIGHT; row++) {
+ for (let column = 0; column < SIGN_MAP_WIDTH; column++) {
+ const bar = SIGN_BAR_COLORS[Math.floor(column / (SIGN_MAP_WIDTH / SIGN_BAR_COLORS.length))];
+ const scanLineDimming = row % 4 === 3 ? 0.35 : 1;
+ const base = (row * SIGN_MAP_WIDTH + column) * 4;
+ pixels[base] = bar[0] * scanLineDimming;
+ pixels[base + 1] = bar[1] * scanLineDimming;
+ pixels[base + 2] = bar[2] * scanLineDimming;
+ pixels[base + 3] = 255;
+ }
+ }
+ return new ImageData(pixels, SIGN_MAP_WIDTH, SIGN_MAP_HEIGHT);
+}
+
+async function emissiveSignScene() {
+ const lighting = constantLighting(0.02);
+ const sign = part('sign', wallQuad(4, 1.6), [0, 0.7, 0.02], [1, 1, 1], {
+ color: [0.02, 0.02, 0.02], roughness: 0.6, emission: 6, emissiveColor: [1, 1, 1], emissiveMap: { image: signEmissiveImage(), colorSpace: 'srgb' },
+ });
+ return {
+ parts: [floor([0.45, 0.43, 0.4]), part('wall', wallQuad(8, 4), [0, 0, 0], [1, 1, 1], { color: [0.25, 0.25, 0.27], roughness: 0.9 }), sign],
+ blenderWorld: lighting.blenderWorld,
+ environment: environment(lighting),
+ camera: { eye: [1.5, 1.4, 5], target: [0, 1.2, 0], up: [0, 1, 0], fov: 45, near: 0.1, far: 60 },
+ shadow: shadowAlongSun(DEFAULT_SUN_DIRECTION, { target: [0, 0, 0], distance: 13.45, extent: 8, near: 0.1, far: 40 }),
+ };
+}
+
export const REFERENCE_SCENES = {
+ 'emissive-sign': emissiveSignScene,
'mountain-valley': mountainValleyScene,
'temple-hall': templeHallScene,
'dark-shaft': darkShaftScene,
diff --git a/bench/size/budgets.json b/bench/size/budgets.json
index bbd3eca4..43b415d3 100644
--- a/bench/size/budgets.json
+++ b/bench/size/budgets.json
@@ -32,7 +32,7 @@
"entry:clutter": 5300,
"entry:light-bake": 28500,
"entry:ground-bounce": 9460,
- "entry:path-tracer": 14600,
+ "entry:path-tracer": 15844,
"entry:texture-set": 900,
"entry:agent-scene": 78650,
"entry:agent-scene+lazy": 261170,
diff --git a/changes/284.md b/changes/284.md
new file mode 100644
index 00000000..598e8a25
--- /dev/null
+++ b/changes/284.md
@@ -0,0 +1 @@
+- Trace emissive maps and homogeneous volume fog in the path tracer, and name what it still skips (issue #284). An `emissiveMap` is read at each hit and scaled by `emission` and `emissiveColor`; `environment.volumeFog` is a uniform medium with exact free-flight sampling, lit by every light and the sky with shadow rays. `metrics.pathTracer.ignored` in an image job result now also lists anisotropy, iridescence, sheen, moss, splat layers and baked light maps. The new `emissive-sign` reference scene scores 0.0800 (the rasterizer scores 0.2372) against Cycles with the path tracer, and `fog` goes from 0.5333 to 0.0312 (the rasterizer scores 0.2021).
diff --git a/docs/parity.md b/docs/parity.md
index 61024b5f..c3e8db21 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -187,7 +187,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.
| Physics > Baking Physics Simulations | partial | Physics records to a timeline in code or when a recipe scene is created, on the main thread. | [film-physics](../tests/film-physics.test.js) | #61 |
| Physics > Simulation Nodes | missing | No node graph. | | #43 |
| Rendering > Render Engines > EEVEE | partial | A WebGL2 rasterizer with PBR, one directional shadow, 16 point lights, fog and bloom. Reflection probes exist behind `bake.probes` (on by default with a bake; specular only, no parallax; [light-bake](light-bake.md)); no irradiance or box probes. | [renderer](../tests/renderer.test.js), [scores against EEVEE](../bench/reference/baseline.json) | #52, #53, #55, #56 |
-| Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It draws normal and metallic-roughness maps (issue #129) and runs about 2.8 times faster per thread, and 3.5 to 3.9 times with the shadow-ray change (inferred from 8,360 to about 30,000 paths per second on the demo room), than at that table, whose scores and seconds predate both (the second table in the reference README has the current ones); it draws them on box-projected materials too, can stop converged pixels on request (`noiseThreshold`, off by default because it costs `spot-area` score, see the reference README), and finishes a 1920 by 1080 still of a 181,708 triangle room at 64 samples in 246 s on 8 threads with `noiseThreshold` 0.03 (about 8 to 9 minutes with every sample, inferred) under a job limit now 600 s; it does not trace volume fog, translucent leaves, occlusion or emissive maps, and it is not Cycles parity. The darker floor was the diffuse layer losing light at grazing angles, fixed in issue #215, which also added light linking: at 64 samples against Cycles `outdoor-hdri` is 0.0226, `character` 0.0287 and `light-linking` 0.0213, and the current scores of every scene are in `bench/reference/path-tracer.json`. `addons/light-bake` bakes bounced light from point, spot and area lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft and standard presets, with fine the same as standard, shrunk deterministically to a path step budget of 5 million, then by bounces, so a preset bakes even a large hall; scene_inspect reports what it used, whether it reduced, bake seconds and skipped parts, which include hair, particle and cloth nodes), patterned, textured and emissive parts bake through a second UV set and a `lightMap` slot, GLB export writes the map approximately as `TEXCOORD_1` emissive, but there are no reflection probes and no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57, #128 |
+| Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); since issue #284 it traces emissive maps and homogeneous volume fog, and at 64 samples `fog` scores 0.0312 against the rasterizer's 0.2021 and the new `emissive-sign` scene 0.0800 against 0.2372; the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It draws normal and metallic-roughness maps (issue #129) and runs about 2.8 times faster per thread, and 3.5 to 3.9 times with the shadow-ray change (inferred from 8,360 to about 30,000 paths per second on the demo room), than at that table, whose scores and seconds predate both (the second table in the reference README has the current ones); it draws them on box-projected materials too, can stop converged pixels on request (`noiseThreshold`, off by default because it costs `spot-area` score, see the reference README), and finishes a 1920 by 1080 still of a 181,708 triangle room at 64 samples in 246 s on 8 threads with `noiseThreshold` 0.03 (about 8 to 9 minutes with every sample, inferred) under a job limit now 600 s; it does not trace translucent leaves, occlusion maps, anisotropy, iridescence or sheen (the job result names them in `metrics.pathTracer.ignored`), and it is not Cycles parity. The darker floor was the diffuse layer losing light at grazing angles, fixed in issue #215, which also added light linking: at 64 samples against Cycles `outdoor-hdri` is 0.0226, `character` 0.0287 and `light-linking` 0.0213, and the current scores of every scene are in `bench/reference/path-tracer.json`. `addons/light-bake` bakes bounced light from point, spot and area lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft and standard presets, with fine the same as standard, shrunk deterministically to a path step budget of 5 million, then by bounces, so a preset bakes even a large hall; scene_inspect reports what it used, whether it reduced, bake seconds and skipped parts, which include hair, particle and cloth nodes), patterned, textured and emissive parts bake through a second UV set and a `lightMap` slot, GLB export writes the map approximately as `TEXCOORD_1` emissive, but there are no reflection probes and no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57, #128 |
| Rendering > Render Engines > Workbench | out of scope | A viewport engine for working by hand. | | |
| Rendering > Cameras | partial | Perspective, orthographic views, focal length, animated paths, depth of field from depth and camera motion blur, both repeatable per frame. Object motion blur and bokeh shapes are missing. | [camera-path](../tests/camera-path.test.js), [camera](../tests/camera.test.js), [render-passes](../tests/render-passes.test.js) | #54 |
| Rendering > Lights > Light Objects | partial | One directional light with a shadow, 16 point lights, 8 spot lights and 7 rectangular area lights. Point and spot lights can cast shadows from one 24-tile atlas (a point light takes 6 tiles, a spot light 1). Area lights use a representative point and cast no shadow. The directional shadow is a single map, or up to four cascades through `addons/cascaded-shadows` (`shadowCascades` on the renderer and `environment.shadowCascades` in recipes, three by themselves when `shadow.extent` is above 40): scene `long-street` scores 0.1555 against Cycles with one map and 0.1398 with three cascades, for about 0.2 ms more a frame on an RTX 3060 when the camera moves. | [lighting](../tests/lighting.test.js), [cascades](../tests/cascaded-shadows.test.js), `npm run reference` scenes `spot-area` and `long-street` | #52 |
diff --git a/docs/path-tracer.md b/docs/path-tracer.md
index 951c3456..356f7b70 100644
--- a/docs/path-tracer.md
+++ b/docs/path-tracer.md
@@ -20,13 +20,15 @@ Unidirectional path tracing against the triangle BVH that the [light bake](light
- Surfaces: diffuse, GGX specular with metals, clear coat, glass (`transmission`, `ior`, rough glass), emission, image maps (`map`, with `alphaMode: "mask"` cutouts, `normalMap` with `normalScale`, and `metallicRoughnessMap`, whose green channel scales roughness and blue scales metallic as in the rasterizer; box-projected materials read all of them through the UVs of their projection, the same ones the glTF export writes) and vertex colour. Skinned parts are drawn at their current pose.
- Lights: the sun (`keyColor`, `lightDirection`, as a 1 degree disk), point lights with a radius, spot lights with a soft cone, rectangular area lights, and the environment map with its rotation. All of them cast soft shadows, whatever their `castShadow` says, as in Cycles. Light linking is honoured: a light with `affects` (or the sun with `environment.keyAffects`) adds nothing at a part it skips, as a direct light or as a bounce source, and still shadows the other lights.
- Light that bounces between surfaces, and the sky seen in mirrors and through glass.
+- Emission: `emission` times `emissiveColor` (the base colour when none is given) times the `emissiveMap` texel at the hit, so a screen or a sign glows with its picture and lights what is near it. An emissive surface is found by the paths that hit it, not sampled as a light, so a small bright panel is noisy at low sample counts.
+- Volume fog: `environment.volumeFog` is traced as a homogeneous medium inside its box, with its `density`, `color` (the scattering albedo), `anisotropy` (Henyey-Greenstein) and `maxDistance`. The distance to each scattering event is drawn from the exact free-flight distribution, so there is no step count and no banding. Every event is lit by next-event estimation (sun, point, spot, area lights and the sky, with shadow rays) and light reaching a surface through the fog is dimmed by it. Fog events count as bounces. `noiseAmount`, `noiseScale`, `drift`, `steps` and the `ambient` glow are rasterizer tricks and are not used.
## What it does not draw
-`report.ignored` lists the ones this scene asks for.
+`report.ignored` lists the ones this scene asks for; a render job returns it as `metrics.pathTracer.ignored`. It names occlusion maps, anisotropy, iridescence, sheen, moss, splat layers, baked `lightMap`s, tagged materials (foliage, liquid, water and the like, traced as plain surfaces), blended transparency, and the fog fields above.
-- Volume fog (`volumeFog`), and the procedural sky when there is no environment map (the sky is black).
-- Occlusion maps and emissive maps. Normal and metallic-roughness maps are drawn on UV-mapped and on box-projected materials. Material graphs and patterns are drawn through the colour map they bake.
+- The procedural sky when there is no environment map (the sky is black).
+- Occlusion maps. Normal and metallic-roughness maps are drawn on UV-mapped and on box-projected materials. Material graphs and patterns are drawn through the colour map they bake.
- Translucent leaves (foliage looks darker than in the rasterizer), liquids, foam and blended transparency (traced as plain or opaque surfaces).
- Lights seen in mirrors (area lights and spot lights are lit but not visible), caustics, subsurface scattering, motion blur, depth of field, bloom and colour grade.
- Multiple-scattering GGX: rough metal is a little darker than in Blender.
diff --git a/src/path-tracer-capabilities.js b/src/path-tracer-capabilities.js
index f9f85c32..183a9d68 100644
--- a/src/path-tracer-capabilities.js
+++ b/src/path-tracer-capabilities.js
@@ -13,6 +13,7 @@ export const PATH_TRACER_JOB_LIMITS = Object.freeze({
export const PATH_TRACER_CAPABILITIES = Object.freeze({
setting: 'settings.renderer { type: "pathTracer", samples, bounces, denoise, seed, maxSeconds, noiseThreshold }; image jobs only, no passes. Past maxSeconds the job fails.',
noiseThreshold: 'Default 0 draws every sample. Above 0 a pixel stops once its standard error relative to its mean is under the value, checked from 16 samples on: faster and noisier, and it cost quality on spot-area (score 0.0658 at 0, 0.0900 at 0.03). docs/path-tracer.md has the table.',
- skips: 'volume fog, occlusion and emissive maps, translucent leaves, liquids, caustics, depth of field, bloom; the job result lists what the scene asked for.',
+ traces: 'emissive maps and strength; volume fog as a uniform medium (density, colour, anisotropy, box; noise, drift and ambient are not used).',
+ skips: 'occlusion maps, translucent leaves, liquids, anisotropy, iridescence, sheen, caustics, depth of field, bloom; metrics.pathTracer.ignored in the job result lists what the scene asked for.',
limits: PATH_TRACER_JOB_LIMITS,
});
diff --git a/src/path-tracer-scene.js b/src/path-tracer-scene.js
index 7d6b615f..cae58caa 100644
--- a/src/path-tracer-scene.js
+++ b/src/path-tracer-scene.js
@@ -2,6 +2,7 @@ import { buildTriangleBvh } from './triangle-bvh.js';
import { createTracer } from './ray-query.js';
import { SUN_BIT, POINT_FIRST_BIT, SPOT_FIRST_BIT, AREA_FIRST_BIT } from './light-link-bits.js';
import { boxProjectedGeometry, columnLengths } from './export-box-uv.js';
+import { resolveTraceVolume } from './path-tracer-volume.js';
// The scene a path trace reads: every part flattened into one world-space triangle soup with per-vertex normals, UVs
// and colours, one resolved material per part, the lights in plain arrays, and the environment map as a sampling table.
@@ -90,6 +91,7 @@ function resolveMaterial(material) {
metallic: material.metallic ?? 0,
roughness: material.roughness ?? 0.5,
emission: emissionColor.map(channel => channel * emissionStrength),
+ emissiveTexture: emissionStrength > 0 ? resolveTexture(material.emissiveMap) : null,
clearcoat: material.clearcoat ?? 0,
clearcoatRoughness: material.clearcoatRoughness ?? 0,
transmission: material.transmission ?? 0,
@@ -261,6 +263,7 @@ export function buildTraceScene(parts, environment = {}) {
materials: parts.map(part => resolveMaterial(part.material ?? {})),
lights: resolveLights(environment),
environment: resolveEnvironment(environment.map),
+ volume: resolveTraceVolume(environment.volumeFog),
surfaceOffset: extent * 1e-5,
farDistance: extent * 1e4,
});
diff --git a/src/path-tracer-volume.js b/src/path-tracer-volume.js
new file mode 100644
index 00000000..03778dce
--- /dev/null
+++ b/src/path-tracer-volume.js
@@ -0,0 +1,63 @@
+import { resolveVolumeFog } from './volumetric.js';
+
+// Homogeneous fog for the path tracer: a box of uniform scattering medium with the colour, density and anisotropy of the
+// rasterizer's `environment.volumeFog`. Distances to the next scattering event are drawn from the exact free-flight
+// distribution, so the cost is one random number per ray segment and there is no step count to trade against quality.
+// The rasterizer's noise, drift and ambient term are not traced: the medium is uniform and lit only by the scene's lights.
+
+/** The medium the tracer reads, or null when the environment has no fog. Throws what the rasterizer throws for bad input. */
+export function resolveTraceVolume(volumeFog) {
+ if (!volumeFog) return null;
+ const resolved = resolveVolumeFog(volumeFog);
+ if (!(resolved.density > 0)) return null;
+ return {
+ density: resolved.density,
+ minimum: resolved.minimum,
+ maximum: resolved.maximum,
+ albedo: resolved.color,
+ anisotropy: resolved.anisotropy,
+ maxDistance: resolved.maxDistance,
+ };
+}
+
+/**
+ * Where the ray is inside the box, as distances along it: writes `[entry, exit]` into `out`
+ * clipped to `[0, limit]` and returns true, or returns false when the ray misses the box in that range.
+ */
+export function volumeInterval(volume, originX, originY, originZ, directionX, directionY, directionZ, limit, out) {
+ let entry = 0;
+ let exit = Math.min(limit, volume.maxDistance);
+ for (let axis = 0; axis < 3; axis++) {
+ const origin = axis === 0 ? originX : axis === 1 ? originY : originZ;
+ const direction = axis === 0 ? directionX : axis === 1 ? directionY : directionZ;
+ if (direction === 0) {
+ if (origin < volume.minimum[axis] || origin > volume.maximum[axis]) return false;
+ continue;
+ }
+ const first = (volume.minimum[axis] - origin) / direction;
+ const second = (volume.maximum[axis] - origin) / direction;
+ entry = Math.max(entry, Math.min(first, second));
+ exit = Math.min(exit, Math.max(first, second));
+ }
+ if (!(entry < exit)) return false;
+ out[0] = entry;
+ out[1] = exit;
+ return true;
+}
+
+/** Henyey-Greenstein value per steradian; `cosine` is between the path direction and the direction toward the light. */
+export function henyeyGreensteinPhase(anisotropy, cosine) {
+ const squared = anisotropy * anisotropy;
+ return (1 - squared) / (4 * Math.PI * (1 + squared - 2 * anisotropy * cosine) ** 1.5);
+}
+
+/**
+ * Draws the cosine of the scattering angle from Henyey-Greenstein. The probability density of the drawn direction is
+ * `henyeyGreensteinPhase(anisotropy, cosine)`, so a scatter keeps its throughput times the albedo.
+ */
+export function sampleHenyeyGreensteinCosine(anisotropy, unit) {
+ if (Math.abs(anisotropy) < 1e-3) return 1 - 2 * unit;
+ const squared = anisotropy * anisotropy;
+ const ratio = (1 - squared) / (1 - anisotropy + 2 * anisotropy * unit);
+ return Math.max(-1, Math.min(1, (1 + squared - ratio * ratio) / (2 * anisotropy)));
+}
diff --git a/src/path-tracer.js b/src/path-tracer.js
index a262ddc4..34d00358 100644
--- a/src/path-tracer.js
+++ b/src/path-tracer.js
@@ -5,6 +5,7 @@ import {
buildFrame, createSurface, environmentPdf, environmentRadiance, evaluateSurface, luminance, mirrorWeight, prepareSurface,
roughnessToAlpha, sampleEnvironment, sampleGlass, sampleSurface,
} from './path-tracer-shading.js';
+import { henyeyGreensteinPhase, sampleHenyeyGreensteinCosine, volumeInterval } from './path-tracer-volume.js';
// Offline still renderer: unidirectional path tracing on the CPU with next-event estimation for every light, the
// environment map drawn by importance, and a wavelet denoiser. It reads the same parts, materials, lights and camera
@@ -34,7 +35,16 @@ const ADAPTIVE_MINIMUM_SAMPLES = 16;
const ADAPTIVE_BATCH_SAMPLES = 8;
// Mean luminance added to the standard error's reference, so very dark pixels are not held to a relative error.
const CONVERGENCE_LUMINANCE_FLOOR = 0.05;
-const IGNORED_MAP_FIELDS = ['occlusionMap', 'emissiveMap'];
+const IGNORED_MAP_FIELDS = ['occlusionMap'];
+// Shading layers of the rasterizer that the tracer's surface model has no term for.
+const IGNORED_LAYERS = [
+ ['anisotropy', material => material.anisotropy > 0],
+ ['iridescence', material => material.iridescence > 0],
+ ['sheen', material => (material.sheenColor ?? []).some(channel => channel !== 0)],
+ ['moss', material => material.moss > 0],
+ ['splat layers', material => Boolean(material.layers || material.layerMaps)],
+ ['lightMap', material => Boolean(material.lightMap)],
+];
function boundedInteger(options, name) {
const limit = PATH_TRACER_LIMITS[name];
@@ -126,7 +136,7 @@ function createHit() {
return {
distance: 0, material: null,
point: new Float64Array(3), normal: new Float64Array(3), color: new Float64Array(3),
- texel: new Float64Array(4), mapTexel: new Float64Array(4),
+ texel: new Float64Array(4), mapTexel: new Float64Array(4), emission: new Float64Array(3),
metallic: 0, roughness: 0,
};
}
@@ -291,6 +301,15 @@ function fillHit(scene, triangleId, originX, originY, originZ, directionX, direc
hit.color[2] *= hit.texel[2];
alpha = hit.texel[3];
}
+ hit.emission[0] = material.emission[0];
+ hit.emission[1] = material.emission[1];
+ hit.emission[2] = material.emission[2];
+ if (material.emissiveTexture) {
+ sampleTexture(material.emissiveTexture, u, v, hit.mapTexel);
+ hit.emission[0] *= hit.mapTexel[0];
+ hit.emission[1] *= hit.mapTexel[1];
+ hit.emission[2] *= hit.mapTexel[2];
+ }
hit.metallic = material.metallic;
hit.roughness = material.roughness;
if (material.surfaceTexture) {
@@ -380,6 +399,8 @@ function createPathTracer(scene, options) {
const normal = new Float64Array(3);
const features = { albedo: new Float64Array(3), normal: new Float64Array(3), depth: 0 };
const random = createRandom();
+ // The denoiser's features come from the first surface a camera ray meets, not from fog in front of it.
+ let featuresRecorded = false;
const { lights, environment } = scene;
if (lights.sun) buildFrame(lights.sun.direction, sunFrame);
const sunCosineMax = Math.cos(SUN_ANGULAR_RADIUS);
@@ -402,8 +423,44 @@ function createPathTracer(scene, options) {
radiance[2] += clampedBlue;
}
+ // True while a light is sampled from a scattering event in the fog instead of from a surface.
+ let inMedium = false;
+ const phaseCandidate = { pdf: 0 };
+ const volumeSpan = new Float64Array(2);
+ const mediumFrame = new Float64Array(9);
+ const scatteredDirection = new Float64Array(3);
+
+ /** The share of light that survives the fog along a shadow ray of the given length. */
+ function fogTransmittance(originX, originY, originZ, distance) {
+ const { volume } = scene;
+ if (!volume) return 1;
+ if (!volumeInterval(volume, originX, originY, originZ, lightDirection[0], lightDirection[1], lightDirection[2], distance, volumeSpan)) return 1;
+ return Math.exp(-volume.density * (volumeSpan[1] - volumeSpan[0]));
+ }
+
+ /** Light from the sampled direction at a scattering event: phase function, shadow ray, fog on the way to the light. */
+ function addMediumDirect(depth, distance, weight) {
+ const { volume } = scene;
+ const cosine = lightDirection[0] * direction[0] + lightDirection[1] * direction[1] + lightDirection[2] * direction[2];
+ const phase = henyeyGreensteinPhase(volume.anisotropy, cosine);
+ const [originX, originY, originZ] = hit.point;
+ if (occluded(scene, originX, originY, originZ, lightDirection[0], lightDirection[1], lightDirection[2], distance, shadowHit)) return;
+ phaseCandidate.pdf = phase;
+ const scale = phase * fogTransmittance(originX, originY, originZ, distance) * weight(phaseCandidate);
+ addRadiance(
+ depth + 1,
+ throughput[0] * lightRadiance[0] * scale,
+ throughput[1] * lightRadiance[1] * scale,
+ throughput[2] * lightRadiance[2] * scale,
+ );
+ }
+
/** Adds the light from one sampled direction: surface value, cosine, shadow ray. `weight` carries MIS and sampling. */
function addDirect(depth, normal, distance, weight) {
+ if (inMedium) {
+ addMediumDirect(depth, distance, weight);
+ return;
+ }
const cosine = normal[0] * lightDirection[0] + normal[1] * lightDirection[1] + normal[2] * lightDirection[2];
if (cosine <= 0) return;
evaluateSurface(surface, lightDirection[0], lightDirection[1], lightDirection[2]);
@@ -413,7 +470,7 @@ function createPathTracer(scene, options) {
const originY = hit.point[1] + normal[1] * scene.surfaceOffset;
const originZ = hit.point[2] + normal[2] * scene.surfaceOffset;
if (occluded(scene, originX, originY, originZ, lightDirection[0], lightDirection[1], lightDirection[2], distance, shadowHit)) return;
- const scale = cosine * weight(surface);
+ const scale = cosine * weight(surface) * fogTransmittance(originX, originY, originZ, distance);
addRadiance(
depth,
throughput[0] * value[0] * lightRadiance[0] * scale,
@@ -428,7 +485,7 @@ function createPathTracer(scene, options) {
const fullWeight = () => 1 / selectionProbability;
// A light skips a part whose mask has its bit clear, at every bounce, so it is no bounce source there either.
- const reaches = light => (hit.material.lightMask >> light.bit & 1) === 1;
+ const reaches = light => inMedium || (hit.material.lightMask >> light.bit & 1) === 1;
function sampleSun(depth, normal) {
if (!reaches(lights.sun)) return;
@@ -571,6 +628,48 @@ function createPathTracer(scene, options) {
features.depth = hit.distance;
}
+ function survivesRoulette(depth) {
+ if (depth < RUSSIAN_ROULETTE_START) return true;
+ const survival = Math.min(0.95, Math.max(0.05, Math.max(throughput[0], throughput[1], throughput[2])));
+ if (random.next() >= survival) return false;
+ for (let channel = 0; channel < 3; channel++) throughput[channel] /= survival;
+ return true;
+ }
+
+ /**
+ * Draws the distance to the next scattering event along the segment. When it falls inside the fog before the segment ends,
+ * puts the event in `hit.point` and returns true; otherwise the ray crosses the fog (or misses it) unchanged, because the
+ * chance of not scattering is exactly the transmittance that the sampling would otherwise multiply in.
+ */
+ function scatterInFog(originX, originY, originZ, segmentLength) {
+ const { volume } = scene;
+ if (!volumeInterval(volume, originX, originY, originZ, direction[0], direction[1], direction[2], segmentLength, volumeSpan)) return false;
+ const eventDistance = volumeSpan[0] - Math.log(1 - random.next()) / volume.density;
+ if (eventDistance >= volumeSpan[1]) return false;
+ hit.point[0] = originX + direction[0] * eventDistance;
+ hit.point[1] = originY + direction[1] * eventDistance;
+ hit.point[2] = originZ + direction[2] * eventDistance;
+ return true;
+ }
+
+ /** Lights the scattering event, then turns `direction` by a Henyey-Greenstein draw. Returns the draw's density. */
+ function scatterInMedium(depth) {
+ const { volume } = scene;
+ for (let channel = 0; channel < 3; channel++) throughput[channel] *= volume.albedo[channel];
+ inMedium = true;
+ addLights(depth, normal);
+ inMedium = false;
+ const cosine = sampleHenyeyGreensteinCosine(volume.anisotropy, random.next());
+ const sine = Math.sqrt(Math.max(0, 1 - cosine * cosine));
+ const azimuth = 2 * Math.PI * random.next();
+ buildFrame(direction, mediumFrame);
+ for (let axis = 0; axis < 3; axis++) {
+ scatteredDirection[axis] = mediumFrame[axis] * sine * Math.cos(azimuth) + mediumFrame[3 + axis] * sine * Math.sin(azimuth) + mediumFrame[6 + axis] * cosine;
+ }
+ for (let axis = 0; axis < 3; axis++) direction[axis] = scatteredDirection[axis];
+ return henyeyGreensteinPhase(volume.anisotropy, cosine);
+ }
+
/** Follows one camera ray. Leaves the radiance in `radiance` and the first-hit features in `features`. */
function trace(originX, originY, originZ, directionX, directionY, directionZ, pixel, sample) {
random.reset(pixel, sample, options.seed);
@@ -581,6 +680,7 @@ function createPathTracer(scene, options) {
throughput[1] = 1;
throughput[2] = 1;
features.albedo.fill(1);
+ featuresRecorded = false;
// A ray that finds nothing has the sky as its feature: one fixed normal and depth, so the filter treats sky as one surface.
features.normal[0] = 0;
features.normal[1] = 0;
@@ -595,7 +695,17 @@ function createPathTracer(scene, options) {
let previousPdf = 0;
let afterMirror = true;
for (let depth = 0; depth <= options.bounces; depth++) {
- if (!intersect(scene, positionX, positionY, positionZ, direction[0], direction[1], direction[2], hit)) {
+ const found = intersect(scene, positionX, positionY, positionZ, direction[0], direction[1], direction[2], hit);
+ if (scene.volume && scatterInFog(positionX, positionY, positionZ, found ? hit.distance : scene.farDistance)) {
+ previousPdf = scatterInMedium(depth);
+ afterMirror = false;
+ positionX = hit.point[0];
+ positionY = hit.point[1];
+ positionZ = hit.point[2];
+ if (!survivesRoulette(depth)) break;
+ continue;
+ }
+ if (!found) {
addEscape(depth, previousPdf, afterMirror);
break;
}
@@ -606,8 +716,11 @@ function createPathTracer(scene, options) {
normal[1] = hit.normal[1] * facing;
normal[2] = hit.normal[2] * facing;
const isGlass = material.transmission > 0 && random.next() < material.transmission;
- if (depth === 0) recordFeatures(normal, isGlass);
- addRadiance(depth, throughput[0] * material.emission[0], throughput[1] * material.emission[1], throughput[2] * material.emission[2]);
+ if (!featuresRecorded) {
+ recordFeatures(normal, isGlass);
+ featuresRecorded = true;
+ }
+ addRadiance(depth, throughput[0] * hit.emission[0], throughput[1] * hit.emission[1], throughput[2] * hit.emission[2]);
const viewX = -direction[0];
const viewY = -direction[1];
const viewZ = -direction[2];
@@ -643,11 +756,7 @@ function createPathTracer(scene, options) {
positionX = hit.point[0] + direction[0] * scene.surfaceOffset;
positionY = hit.point[1] + direction[1] * scene.surfaceOffset;
positionZ = hit.point[2] + direction[2] * scene.surfaceOffset;
- if (depth >= RUSSIAN_ROULETTE_START) {
- const survival = Math.min(0.95, Math.max(0.05, Math.max(throughput[0], throughput[1], throughput[2])));
- if (random.next() >= survival) break;
- for (let channel = 0; channel < 3; channel++) throughput[channel] /= survival;
- }
+ if (!survivesRoulette(depth)) break;
}
}
@@ -675,13 +784,16 @@ export function toneMapToRgba8(linear, width, height) {
/** Names what this scene asks for that the path tracer does not draw, so a result never claims more than it traced. */
export function describeIgnoredFeatures(parts, environment) {
const notes = new Set();
- if (environment?.volumeFog) notes.add('volumeFog is not traced.');
+ const fog = environment?.volumeFog;
+ if (fog?.density > 0 && (fog.noiseAmount ?? 0.5) > 0) notes.add('volumeFog is traced as a uniform medium: noiseAmount, noiseScale and drift are ignored.');
+ if (fog?.density > 0 && fog.ambient) notes.add('volumeFog.ambient is not added: the fog is lit by the traced lights and sky.');
if (!environment?.map) notes.add('There is no environment map, so the sky is black and only the lights shine.');
for (const part of parts) {
const material = part.material ?? {};
for (const field of IGNORED_MAP_FIELDS) if (material[field]) notes.add(`${field} is ignored.`);
if (material.tag && material.tag !== 'surface') notes.add(`${material.tag} materials are traced as plain surfaces.`);
if (material.alphaMode === 'blend') notes.add('Blended transparency is traced as opaque.');
+ for (const [name, isUsed] of IGNORED_LAYERS) if (isUsed(material)) notes.add(`${name} is ignored.`);
}
return [...notes];
}
diff --git a/tests/path-tracer-emissive-fog.test.js b/tests/path-tracer-emissive-fog.test.js
new file mode 100644
index 00000000..c70c5089
--- /dev/null
+++ b/tests/path-tracer-emissive-fog.test.js
@@ -0,0 +1,122 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+
+import { describeIgnoredFeatures, renderPathTracedImage } from '../src/path-tracer.js';
+import { henyeyGreensteinPhase, resolveTraceVolume, sampleHenyeyGreensteinCosine, volumeInterval } from '../src/path-tracer-volume.js';
+
+const LOOKING_DOWN = { eye: [0, 3, 0], target: [0, 0, 0], up: [0, 0, -1], fov: 40 };
+const IMAGE = { width: 16, height: 16, denoise: false, threads: 1, bounces: 4 };
+const CENTER_PIXEL = (8 * 16 + 8) * 3;
+
+function groundQuad() {
+ const half = 20;
+ return {
+ positions: new Float32Array([-half, 0, half, half, 0, half, half, 0, -half, -half, 0, -half]),
+ normals: new Float32Array([0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]),
+ uvs: new Float32Array([0, 1, 1, 1, 1, 0, 0, 0]),
+ indices: new Uint32Array([0, 1, 2, 0, 2, 3]),
+ };
+}
+
+function ground(materialExtra) {
+ return [{ name: 'ground', geometry: groundQuad(), material: { tag: 'surface', metallic: 0, roughness: 1, color: [0, 0, 0], emission: 0, ...materialExtra } }];
+}
+
+function singleTexel(red, green, blue) {
+ return { image: { data: new Uint8Array([red, green, blue, 255]), width: 1, height: 1 }, colorSpace: 'srgb' };
+}
+
+async function centerRadiance(parts, environment, samples) {
+ const { linear } = await renderPathTracedImage({ parts, environment, camera: LOOKING_DOWN }, { ...IMAGE, samples });
+ return [linear[CENTER_PIXEL], linear[CENTER_PIXEL + 1], linear[CENTER_PIXEL + 2]];
+}
+
+test('an emissive map colours the emission and the strength scales it', async () => {
+ const lookup = value => ((value / 255 + 0.055) / 1.055) ** 2.4;
+ const [red, green, blue] = await centerRadiance(ground({ emission: 2, emissiveColor: [1, 1, 1], emissiveMap: singleTexel(255, 128, 0) }), {}, 1);
+ assert.ok(Math.abs(red - 2) < 1e-6, `red ${red}`);
+ assert.ok(Math.abs(green - 2 * lookup(128)) < 1e-6, `green ${green}`);
+ assert.equal(blue, 0);
+ const [unmapped] = await centerRadiance(ground({ emission: 2, emissiveColor: [1, 1, 1] }), {}, 1);
+ assert.equal(unmapped, 2);
+ const [switchedOff] = await centerRadiance(ground({ emission: 0, emissiveMap: singleTexel(255, 255, 255) }), {}, 1);
+ assert.equal(switchedOff, 0);
+});
+
+test('an emissive map no longer appears among the ignored features', () => {
+ const notes = describeIgnoredFeatures([{ material: { emissiveMap: {}, emission: 1 } }], {});
+ assert.ok(!notes.some(note => note.includes('emissiveMap')), notes.join(' '));
+});
+
+const FOG_SLAB = { minimum: [-30, 1, -30], maximum: [30, 2, 30], steps: 8 };
+
+test('an absorbing fog slab removes light by exp(-density * thickness)', async () => {
+ const parts = ground({ emission: 1, emissiveColor: [1, 1, 1] });
+ const [clear] = await centerRadiance(parts, {}, 1);
+ const [thin] = await centerRadiance(parts, { volumeFog: { ...FOG_SLAB, density: 1, color: [0, 0, 0] } }, 1024);
+ assert.equal(clear, 1);
+ // The centre ray crosses 1 unit of fog; 1024 samples leave a standard error near 0.015.
+ assert.ok(Math.abs(thin - Math.exp(-1)) < 0.06, `transmitted ${thin}`);
+});
+
+test('a lit fog slab scatters sunlight toward the camera over a black floor', async () => {
+ // A black metal floor reflects nothing, so every bit of light in the picture comes from the fog.
+ const parts = ground({ metallic: 1 });
+ const sun = { keyColor: [3, 3, 3], lightDirection: [0, 1, 0] };
+ const fog = { ...FOG_SLAB, density: 0.1, color: [1, 1, 1], anisotropy: 0.3 };
+ const { linear: clear } = await renderPathTracedImage({ parts, environment: sun, camera: LOOKING_DOWN }, { ...IMAGE, samples: 4 });
+ const { linear: fogged } = await renderPathTracedImage({ parts, environment: { ...sun, volumeFog: fog }, camera: LOOKING_DOWN }, { ...IMAGE, samples: 64, bounces: 1 });
+ assert.ok(Math.max(...clear) < 1e-6);
+ // One scattering event per path: sun 3 * phase(back scatter, g 0.3) 0.033 * (1 - exp(-0.2)) / 2 = 0.009; a second event (about 0.002 more, with the longer oblique rays) is lit with a rounder phase.
+ const mean = fogged.reduce((sum, value) => sum + value, 0) / fogged.length;
+ assert.ok(mean > 0.0075 && mean < 0.014, `scattered ${mean}`);
+});
+
+test('fog is the same in a repeat render', async () => {
+ const parts = ground({ emission: 1, emissiveColor: [1, 1, 1] });
+ const environment = { keyColor: [2, 2, 2], lightDirection: [1, 1, 0], volumeFog: { ...FOG_SLAB, density: 0.5 } };
+ const first = await centerRadiance(parts, environment, 8);
+ const second = await centerRadiance(parts, environment, 8);
+ assert.deepEqual(first, second);
+});
+
+test('fog with no density, or none at all, builds no medium', () => {
+ assert.equal(resolveTraceVolume(undefined), null);
+ assert.equal(resolveTraceVolume({ density: 0 }), null);
+ assert.throws(() => resolveTraceVolume({ density: -1 }), RangeError);
+});
+
+test('the fog box clips a ray to where it is inside', () => {
+ const volume = resolveTraceVolume({ density: 1, minimum: [-1, 0, -1], maximum: [1, 2, 1] });
+ const span = new Float64Array(2);
+ assert.ok(volumeInterval(volume, 0, 5, 0, 0, -1, 0, 100, span));
+ assert.deepEqual([...span], [3, 5]);
+ assert.ok(volumeInterval(volume, 0, 1, 0, 0, -1, 0, 100, span));
+ assert.deepEqual([...span], [0, 1]);
+ assert.ok(!volumeInterval(volume, 0, 5, 0, 0, -1, 0, 2, span), 'the surface comes before the fog');
+ assert.ok(!volumeInterval(volume, 3, 5, 0, 0, -1, 0, 100, span), 'a ray beside the box');
+ assert.ok(!volumeInterval(volume, 0, 5, 0, 1, 0, 0, 100, span), 'a ray going away');
+});
+
+test('Henyey-Greenstein draws follow their density', () => {
+ for (const anisotropy of [-0.5, 0, 0.3, 0.8]) {
+ // The phase function integrates to 1 over the sphere, and the draw has the matching mean cosine (= anisotropy).
+ let integral = 0;
+ const slices = 20000;
+ for (let slice = 0; slice < slices; slice++) integral += henyeyGreensteinPhase(anisotropy, -1 + (2 * (slice + 0.5)) / slices) * 2 * Math.PI * (2 / slices);
+ assert.ok(Math.abs(integral - 1) < 1e-3, `integral ${integral} for g ${anisotropy}`);
+ let meanCosine = 0;
+ const draws = 20000;
+ for (let draw = 0; draw < draws; draw++) meanCosine += sampleHenyeyGreensteinCosine(anisotropy, (draw + 0.5) / draws) / draws;
+ assert.ok(Math.abs(meanCosine - anisotropy) < 0.01, `mean cosine ${meanCosine} for g ${anisotropy}`);
+ }
+});
+
+test('the report says the fog is traced as a uniform medium only when noise or ambient were asked for', () => {
+ const noisy = describeIgnoredFeatures([{ material: {} }], { volumeFog: { density: 1, noiseAmount: 0.5 } });
+ assert.ok(noisy.some(note => note.includes('uniform medium')));
+ const plain = describeIgnoredFeatures([{ material: {} }], { volumeFog: { density: 1, noiseAmount: 0 } });
+ assert.ok(!plain.some(note => note.includes('uniform medium') || note.includes('ambient')), plain.join(' '));
+ const none = describeIgnoredFeatures([{ material: {} }], { volumeFog: { density: 0 } });
+ assert.ok(!none.some(note => note.includes('volumeFog')));
+});
diff --git a/tests/path-tracer.test.js b/tests/path-tracer.test.js
index 8d144973..43507ae1 100644
--- a/tests/path-tracer.test.js
+++ b/tests/path-tracer.test.js
@@ -180,11 +180,13 @@ test('the display transform matches the rasterizer post pass at known values', (
test('what the tracer does not draw is named in the report', () => {
const notes = describeIgnoredFeatures(
- [{ material: { emissiveMap: {}, tag: 'liquid' } }, { material: { alphaMode: 'blend' } }],
+ [{ material: { occlusionMap: {}, tag: 'liquid' } }, { material: { alphaMode: 'blend', anisotropy: 0.5, iridescence: 1 } }],
{ volumeFog: { density: 1 } },
);
assert.ok(notes.some(note => note.includes('volumeFog')));
- assert.ok(notes.some(note => note.includes('emissiveMap')));
+ assert.ok(notes.some(note => note.includes('occlusionMap')));
+ assert.ok(notes.some(note => note.includes('anisotropy')));
+ assert.ok(notes.some(note => note.includes('iridescence')));
assert.ok(notes.some(note => note.includes('liquid')));
assert.ok(notes.some(note => note.includes('Blended')));
assert.ok(notes.some(note => note.includes('environment map')));