Repository navigation
Soften diffuse light on a normal-mapped surface like Cycles' bump shadowing (codepawl/crucible#1842) - #58
Merged
Conversation
…dowing (codepawl/crucible#1842) Cycles multiplies the value of a diffuse lobe whose normal was perturbed by a bump or normal map with bsdf_G<GGX>(min(0.125 * tan2(deviation), 1), |cos(smooth normal, light)|), the default "bump map correction". Cook only had the hard half of that term (zero light when the light, the smooth normal and the lobe normal disagree about the side), so a tilted normal lit the part of a curved surface that faces away from the light, 20 to 45 percent more than Cycles in the band within 12 degrees of the terminator. closure_bump_shadowing_weight now returns the factor and closure_eval scales the lobe value by it (the pdf is left alone, as in Cycles). It applies to the diffuse and diffuse transmission lobes, and only when the scene has a normal map. Measured against Cycles 5.3 at 480x270, 256 spp, flattened scenes, UV sphere with the bumpy map: mean ratio 1.0122, relMSE 0.0011, 5 of 64 tiles over 5 percent (worst 1.121) became 0.9998, relMSE 1.8e-5, 0 tiles over (worst 0.995). Constant tilt along the map's red axis: 1.018, 0.0015, 6 tiles over became 0.9992, 2.1e-5, 0 tiles over. A sphere without a map and the instanced plane are unchanged.
anxuanng
added a commit
to codepawl/crucible
that referenced
this pull request
Nov 16, 2026
Cook 158384e4 (codepawl/cook#58, unmerged) scales a normal-mapped diffuse lobe by Cycles' bump shadowing term. Part of #1111.
This was referenced Nov 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of codepawl/crucible#1842 (and #1111).
Cause
Cycles scales the value of a diffuse lobe whose normal came from a bump or normal map by
bsdf_G<GGX>(min(0.125 * tan2(deviation), 1), |cos(smooth normal, light)|)(bump_shadowing_term, on by default as "bump map correction"). Cook had only the hard half of that term, so a tilted normal lit the part of a curved surface that faces away from the light.It was not tangent generation: error is independent of tessellation (16, 48 and 96 segments all gave about 1.01), not concentrated at the poles, and Cycles' own tilted normal (rendered as an emission colour) is within 0.5 degrees of the analytic one. With one light and no ambient, Cook matched an analytic Lambert model while Cycles kept 21 percent of it at
cos(smooth normal, light)0 to 0.05, 53 percent at 0.05 to 0.1 and 77 percent at 0.1 to 0.2.Change
closure_bump_shadowing_weightreturns the factor andclosure_evalscales the lobe value by it (pdf untouched, as in Cycles), for diffuse and diffuse transmission lobes, only when the scene has a normal map.Evidence
Cycles 5.3, 480x270, 256 spp, flattened scenes, mean ratio / relMSE / tiles over 5 percent:
Still open: a flattened non-uniformly scaled plane (matrix baked into the vertices) keeps the full tilt, 0.956 before and 0.951 after.
node tools/run-cargo-tests.mjs: 140 and 23 passed.release-guard: clean.