Skip to content

3D engine that AI agents drive

Merge remote-tracking branch 'origin/main' into 1833-cook-environment-colours

Nguyen Xuan Anc9779730c1aa
diff --cc docs/path-tracer.md
index a30b07ca,c7072c6d..ad63b0af
--- a/docs/path-tracer.md
+++ b/docs/path-tracer.md
@@@ -30,7 -30,16 +30,16 @@@ Unidirectional path tracing against th
A shading point behind the portal (outside) is lit by BSDF samples only, and a ray that reaches the sky by another way than a portal still counts in full. The CPU tracer samples the sky through the portals in the same way (`src/path-tracer-portal.js`: a portal chosen uniformly, a point uniform on it, the pdf summed over the portals the direction crosses), and its next-event light for the sky is drawn through them. The WebGPU tracer does the same in its megakernel and wavefront kernels (the portals sit at the end of the environment table buffer), and the real-time WebGPU tracer does not use them yet. The WebGL tracer draws no light from a portal and names it in `report.ignored`. The agent scene tools do not take `portal` yet.
![The same dim room corner lit only by the sky through a window, 64 samples a pixel in Cook: without a portal (left, grainy) and with one over the window (right, smooth), at the same brightness](cook-light-portals.jpg)
-- Exposure (#1833): a render job's `effects.exposure` multiplies the traced linear picture before the view transform, on the CPU, WebGL and WebGPU backends and on a native frame; `renderPathTracedImage` and `toneMapToRgba8` take it as `exposure` (a number above 0, default 1), and the linear pixels it returns are not scaled. A scene with no sun, sky or lamp traces black. `ambientIntensity`, `fillIntensity`, `daylight` and `skyTop`/`skyBottom` are rasterizer terms: the tracer lights the scene with the environment map, so use `environmentIntensity` to scale the sky.
+- Exposure (#1833): a render job's `effects.exposure` multiplies the traced linear picture before the view transform, on the CPU, WebGL and WebGPU backends and on a native frame; `renderPathTracedImage` and `toneMapToRgba8` take it as `exposure` (a number above 0, default 1), and the linear pixels it returns are not scaled. A scene with no sun, sky or lamp traces black. `ambientIntensity` multiplies the environment map strength, as it scales the rasterizer's environment light (Cycles: the World Background strength; `src/path-trace-terms.js`); a camera ray still sees the sky at the unscaled strength on the native kernel. `fillIntensity` (two fixed unshadowed lights) and `world: true` (outdoor haze shading) are rasterizer only, and the render report says so when a recipe sets them. `daylight` and `skyTop`/`skyBottom` change nothing in the rasterizer while an environment map lights the scene, which every recipe has, so the trace agrees. `world: false` hides nothing from the trace: a camera ray sees the environment map, where the rasterizer draws a flat background. Light the shadow side with a point or area light or `environmentIntensity`.
+
+ Raster against tracer on a daylit interior (#1334, `bench/reference/interior-exposure.mjs`: an 8 x 6.5 m room with one window, physical sky, sun bounce 2, AgX, 960 x 540, GPU tracer, 48 samples, no denoiser). Before #1833 the tracer ignored `effects.exposure`, so the room looked about 3 stops darker than the raster at exposure 3.6. Now both apply it, and the tracer is the brighter one, because it carries the light that bounces around the room and the raster fill is lower (raising `sunBounce` to 8 lifts the raster mean only from 31.9 to 47.6 of 255):
+
+ | `effects.exposure` | Raster mean (display, linear) | Tracer mean (display, linear) | Tracer over raster, linear |
+ |---|---|---|---|
+ | 1 | 16.7, 0.0143 | 33.5, 0.0278 | 1.9 |
+ | 3.6 | 31.9, 0.0385 | 73.1, 0.1042 | 2.7 |
+
+ The sunlit floor patch agrees to within a stop (158.8, 127.2, 82.1 against 134.2, 106.0, 74.2 at exposure 1); the gap sits on the walls and ceiling in shade (display 37 against 17 on the back wall at exposure 1). A sealed room still traces black (0.0006 linear), so the extra light is not leaking sky. To match a raster look with the tracer, lower `effects.exposure` (about 1 where the raster used 3.6 in this room) rather than raising it past its cap of 16.
- 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.
- Sky strength seen by the camera (native `cycles` kernel only, #1121): `environment.cameraIntensity` (a number of 0 or more, in the units of `map.intensity`; left out, the camera sees the sky at the lighting intensity and nothing changes) is the strength of the sky for a camera ray and for a ray that reaches it from the camera through a cutout, a transparent surface or smooth glass, while the sky keeps lighting the scene at `map.intensity`. It is what Cycles does with a Light Path 'Is Camera Ray' mix in the world, and it replaces a second trace with the opaque surfaces black. The strength applies until the path first bounces off a diffuse or glossy surface, reflects (also off glass), crosses rough glass or a translucent surface, or scatters in fog; sun disks and emissive surfaces are not scaled. The CPU, WebGL and WebGPU tracers ignore it and `report.ignored` says so.