Fix medium layer base weight in testrender - #2153
Merged
lgritz merged 1 commit intoAug 25, 2026
Merged
Conversation
Restore the pre-rewrite medium traversal behavior by avoiding a second application of the incoming weight to a layer base. Add a render regression comparing directly weighted and layered media. Assisted-by: OpenAI Codex / GPT-5 Signed-off-by: Tomas Davidovic <tdavidovic@nvidia.com>
|
|
Contributor
|
Good catch. LGTM! |
aconty
approved these changes
Aug 25, 2026
Contributor
|
Yes, good catch! Thanks for cleaning up my mess. |
Collaborator
|
I'm seeing that sanitizer failure on multiple branches, so I'm sure it's not related to this PR and will not let that hold things up. Great fix, merging. |
lgritz
merged commit Aug 25, 2026
a97af52
into
AcademySoftwareFoundation:main
25 of 26 checks passed
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.
Restore the pre-rewrite medium traversal behavior by avoiding a second application of the incoming weight to a layer base. Add a render regression comparing directly weighted and layered media.
Assisted-by: OpenAI Codex / GPT-5
Description
The non-recursive
process_medium_closuretraversal introduced in #1897applies the incoming weight twice when it saves the base of a MaterialX layer.
base_walready includes the incoming weight:base_w = weight * (1 - opacity(top));The iterative walker then saves
weight * base_w, giving a layer reachedwith weight
sans * sfactor on its base medium. The previous recursivewalker passed
base_wdirectly, as does the current BSDF walker.This change restores that behavior by saving
base_wwithout multiplying bythe incoming weight again.
This is an internal testrender correction with no OSL language or public API
change, so no documentation update is needed.
Tests
The
render-mx-medium-vdftest now renders a directly weighted absorbingmedium beside the same medium under a negligible layer top:
With the fix, the two spheres match. Before the fix, the layered sphere uses
0.5 * 0.5for its medium weight and is visibly less dense; 22.7% of pixelsexceed the test's
idiffthreshold.Local validation on Windows:
testrenderandoslccompleted successfully.render-mx-medium-vdf.optpasses through the standard test harness.git diff --checkpass.Codex was used to audit the iterative traversal against its recursive
predecessor, prepare the regression scene, and draft the fix and tests. I
reviewed the resulting changes and test output.
Checklist
and if I used AI coding assistants, I have an
Assisted-by: TOOL / MODELline in the pull request description above.
behavior.
PR, by pushing the changes to my fork and seeing that the automated CI
passed there. (Exceptions: If most tests pass and you can't figure out why
the remaining ones fail, it's ok to submit the PR and ask for help. Or if
any failures seem entirely unrelated to your change; sometimes things break
on the GitHub runners.)
fixed any problems reported by the clang-format CI test.