Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Quote the measured 2 to 5 percent and name the two map differences left (#1030)

Nguyen Xuan Ana3609c949358
diff --git a/bench/cycles-parity/texture-scenes.mjs b/bench/cycles-parity/texture-scenes.mjs
index fed86e77..e9943edd 100644
--- a/bench/cycles-parity/texture-scenes.mjs
+++ b/bench/cycles-parity/texture-scenes.mjs
@@ -116,7 +116,7 @@ function textureSplitScene(include) {
}
// An emissive quad seen head on with no light in the room, so a pixel is the texture itself and the mean of the picture is
-// known in closed form from the texels (`texture-mean-expectation.py`). Cook and Cycles differ here only in how they read a
+// known in closed form from the texels. Cook and Cycles differ here only in how they read a
// texture. One frame covers 10 degrees of a 3 x 3 repeat of the quad.
function emissiveProbeScene(colorSpace) {
const emissiveMap = { image: gradientChecker(false), colorSpace };
diff --git a/changes/1030.md b/changes/1030.md
index f6ea464b..a87c6adc 100644
--- a/changes/1030.md
+++ b/changes/1030.md
@@ -1 +1 @@
-- The Cycles kernel decodes an 8-bit sRGB colour map after filtering it, as Blender Cycles does, so textured surfaces no longer render 2 to 3.5 percent brighter than Cycles (#1030)
+- The Cycles kernel decodes an 8-bit sRGB colour map after filtering it, as Blender Cycles does, so textured surfaces no longer render 2 to 5 percent brighter than Cycles (#1030)
diff --git a/docs/cycles-parity.md b/docs/cycles-parity.md
index f7e477e2..7dd0c4a0 100644
--- a/docs/cycles-parity.md
+++ b/docs/cycles-parity.md
@@ -1094,4 +1094,6 @@ Cook over Cycles, 2048 spp, 960 x 540, seed 1, mean ratio R, G, B and relMSE (ep
Still open: the mask quad is 1.1 to 1.5 percent bright. Two renders of the diagnostic scenes (`tex-mask-alone`: the mask quad without the backdrop; `tex-mask-opaque-map`: the backdrop plus the same mask material over an opaque map) put it off the texture read: with the backdrop removed the quad is 1.0021, 1.0022, 1.0012 (measured in a build that also blended colour weighted by alpha, which did not move the full scene beyond 0.2 percent, so it was dropped), and with an opaque map under the mask material the whole scene is 1.0001. The ratio map of `tex-split-mask` puts the excess in the columns of the cutout holes and in the strip of backdrop below the quad, where Cook is up to 40 percent brighter: the light that reaches the backdrop past a cutout, not the colour of the quad. The cause there is not known.
+Two known differences from Cycles remain in the read of a map and are not changed here. Cycles premultiplies the stored values of a byte image by alpha before the filter and divides by alpha after it when the alpha output is used; the kernel filters straight colour and alpha independently, which differs only where alpha varies between neighbouring texels. And the packed mean colour of an emissive map (`meanLinearRgb`, used for the radiance of a light sample on a textured emitter) is still the mean of the decoded texels, a few percent above the filtered read on a high-contrast sRGB map.
+
Commands: `node bench/cycles-parity/texture-scenes.mjs <dir>` also writes `tex-emit-srgb`, `tex-emit-linear`, `tex-split-*`, `tex-mask-alone` and `tex-mask-opaque-map`; `native-texture-sampler.test.js` holds a GPU-gated test of the seam between a black and a white texel (0.214 linear when blended before decoding, 0.5 when decoded first).
diff --git a/packages/render-native/src/cycles/closure.wgsl b/packages/render-native/src/cycles/closure.wgsl
index eaf903b8..d2038918 100644
--- a/packages/render-native/src/cycles/closure.wgsl
+++ b/packages/render-native/src/cycles/closure.wgsl
@@ -98,7 +98,7 @@ fn texture_fetch_texel(desc: TextureDescriptor, ix: i32, iy: i32, format: u32) -
}
// An 8-bit sRGB map is filtered on its stored values and decoded after, the way Blender Cycles reads a byte image. Decoding
-// each texel first and filtering after makes every blended texel brighter (the decode curve is convex): 2 to 7 percent of the
+// each texel first and filtering after makes every blended texel brighter (the decode curve is convex): 2 to 5 percent of the
// mean of a checker map at texel scale (#1030).
fn texture_decode_filtered(color: vec4<f32>, format: u32) -> vec4<f32> {
if (format == 1u) {
diff --git a/packages/render-native/src/cycles/mod.rs b/packages/render-native/src/cycles/mod.rs
index 4ac9ab2f..0942b714 100644
--- a/packages/render-native/src/cycles/mod.rs
+++ b/packages/render-native/src/cycles/mod.rs
@@ -1133,7 +1133,7 @@ mod tests {
}
/// Blender Cycles filters the stored values of an 8-bit sRGB image and decodes the blend. Decoding each texel before the
- /// blend reads 2 to 7 percent too bright on a checker map (#1030).
+ /// blend reads 2 to 5 percent too bright on a checker map (#1030).
#[test]
fn an_srgb_map_is_decoded_after_the_filter_and_not_per_texel() {
let kernel = assemble_cycles_kernel().expect("the kernel assembles");