Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Measure the graph bump against Blender's Bump node (part of #50)

Nguyen Xuan An98233efbaa6e
diff --git a/bench/reference/README.md b/bench/reference/README.md
index cc8e3060..c1e38ea6 100644
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@ -432,6 +432,13 @@ Where the `brick-graph` gap comes from (issue #50, measured 2026-11-01 on the RT
Noise contributes nothing (0.2269 against 0.2270 without it), so the different noise function is not part of the gap. Colour structure alone adds 0.010 and the bump alone adds 0.023, and the two overlap. EEVEE, which reads the same node graph and the same Bump node, is also 0.009 above its own flat wall (0.1440 against 0.1351), so the condition that a graph must score no worse than a flat wall against Cycles can not be met by an independent renderer either: FLIP counts any misplaced fine structure against a flat wall that has none. What is left over 67js is 0.083 above EEVEE's own distance to Cycles for the graph and 0.065 for the flat wall. Blender's Bump node takes a one-sided slope over a footprint of 0.1 pixel (the node's Filter Width), so the bright side of a joint is thin and faint in Cycles, while 67js reads a central difference over two texels, which gives both sides a band. Setting Filter Width to 1 pixel lowered `brick-graph` to 0.2232 and 2 pixels to 0.2208, but the second one raised the EEVEE score from 0.1480 to 0.1565, so it moved the sides apart as much as it moved them together and the harness keeps the default. A 1024 texel bake of the bump only variant scored 0.2140 against 0.2184 at 512 (Filter Width 1), but the full graph is over the 30,000,000 work limit at 1024, so the scene stays at 512. With bounced light baked into the wall and floor (`--bake`, which removes the indirect light difference) `brick-flat` scores 0.1531 and `brick-graph` 0.1892, so the gap does not come from the missing indirect light either. No engine defect was found: the slope of the bake matches Blender's Bump node on distance (0.15 is the geometric mean of 6/32 and 4/32 for the 6 by 4 wall, since a texel slope is per UV unit), the sign and the colour space are the same on both sides. The condition stays open; a fair measure to report next to the raw score is the excess over EEVEE's distance to Cycles on the same scene (0.0829 for `brick-graph`, 0.0648 for `brick-flat`), never in place of it.
+Bump against Blender's formula (issue #50, measured 2026-11-03, RTX 3060, stored Blender renders, `--skip-blender`, GPU column). Read from `gpu_shader_material_bump.bsl.hh` and Cycles `svm_node_set_bump` (`displace.h`): `N' = normalize(filter_width * abs(det) * N - distance * sign(det) * surfgrad)`, then `normalize(mix(N, N', strength))`. The height difference is divided by the filter width, so the tilt is `distance` times the height's slope per world unit, with strength 1 here (the node's default). 67js's `normalMapFromHeights` builds `normalize(-slope, 1)` from the same kind of slope, so the form is the same. The scale is not: 67js's slope is `bump / 32` times the height slope per UV unit, and Blender's is `0.15 * bump` per world unit, which for the 6 by 4 wall is `0.025 * bump` along U and `0.0375 * bump` along V, so 67js is 1.25 times too strong along U and 0.83 times along V. Matching Blender's numbers exactly (a throwaway edit giving each axis the wall's world size, not committed) moved `brick-graph` against Cycles from 0.1602 to 0.1599 and against EEVEE from 0.0896 to 0.0891, and `brick-flat` is untouched at 0.1272, so the excess over EEVEE on the same scene (67js against Cycles minus EEVEE against Cycles) went from 0.0381 to 0.0378 (flat wall 0.0174). The scale is not what separates the two, and the engine is unchanged. What remains is the footprint: Blender's one-sided difference over 0.1 pixel against a central difference over two baked texels. A faithful match would also need the bump in world units, which a baked normal map cannot know without the surface's UV size, so it would be a shader change; it is not worth doing for 0.0003. The older figures above (0.2269, 0.1999, 0.0829 against 0.0648) are from the two-sun, floor state of the scene; the same scene now scores as in this paragraph.
+
+| Scene | Cycles, before | Cycles, scale matched | EEVEE, before | EEVEE, scale matched | EEVEE against Cycles |
+| --- | --- | --- | --- | --- | --- |
+| `brick-graph` | 0.1602 | 0.1599 | 0.0896 | 0.0891 | 0.1221 |
+| `brick-flat` | 0.1272 | 0.1272 | 0.0462 | 0.0462 | 0.1098 |
+
## Cloth
`npm run reference -- --cloth` draws a pinned banner in wind (1 and 2 s) and a sheet dropped on a ball (0.5, 1 and 2 s). 67js bakes the sheet with its own solver; Blender bakes the same 13 by 13 grid with its cloth modifier from rest to the same time, stepping every frame, and renders that mesh in Cycles and EEVEE. Scores go to `cloth.json` and `images/cloth-*.jpg`, as FLIP over the whole frame and over the pixels the scene covers (`asset-*`, sky left out). Both solvers get the same mass (0.2 kg/m2, so 0.2 times the sheet area over 169 particles in Blender), gravity and drag; stiffness and bend stay at each side's defaults, because position based stiffness and Blender's tension, compression, shear and bending do not map one to one.
diff --git a/changes/issue-50-bump.md b/changes/issue-50-bump.md
new file mode 100644
index 00000000..45eaebe5
--- /dev/null
+++ b/changes/issue-50-bump.md
@@ -0,0 +1 @@
+- Compare the graph bump with Blender's Bump node (part of issue #50, no engine change): the formula has the same form, and the scale differs by 1.25 along U and 0.83 along V on the `brick-graph` wall. Matching Blender's scale moved `brick-graph` against Cycles from 0.1602 to 0.1599, so the scale is not the gap; the measurements and the Blender source are in `bench/reference/README.md`.