Skip to content

Use Qualitative Oren-Nayar to match Standard Surface spec - #61

Merged
ppenenko merged 2 commits into
metashade/devfrom
metashade/fix-diffuse-energy-compensation
Aug 25, 2026
Merged

Use Qualitative Oren-Nayar to match Standard Surface spec#61
ppenenko merged 2 commits into
metashade/devfrom
metashade/fix-diffuse-energy-compensation

Conversation

@ppenenko

Copy link
Copy Markdown
Member

Summary

  • Update Metashade SS to use energy_compensation=false (Qualitative Oren-Nayar) matching the stock Standard Surface nodegraph
  • Remove masonry from test exclusion list — FLIP threshold failure (0.073 > 0.05) is resolved
  • Bump metashade submodule to metashade/metashade#229

Note: Rendered shader baselines under metashade_ref/renders/ are not included in this PR to keep the diff reviewable. They will be regenerated by CI or a follow-up commit.

Context

The Metashade Standard Surface was using energy_compensation=true (EON model) on the Oren-Nayar diffuse BSDF. While more physically correct, this deviates from the stock Standard Surface spec which intentionally uses the uncompensated Qualitative Oren-Nayar model (energy_compensation=false). OpenPBR adopts EON, but Standard Surface does not — its diffuse_roughness docstring explicitly states "higher values cause the surface to appear flatter and darker."

The difference only manifests with non-zero diffuse_roughness. Masonry (diffuse_roughness=0.5) was the only affected Adsk material, producing FLIP 0.073 > 0.05 threshold.

Test plan

  • All 121 Metashade tests pass (including masonry)
  • CI passes

Update Metashade SS to set energy_compensation=false on the diffuse
BSDF, aligning with the stock Standard Surface nodegraph.  Remove
masonry from the test exclusion list now that the FLIP threshold
failure is resolved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns Metashade Standard Surface diffuse rendering with Qualitative Oren–Nayar.

Changes:

  • Disables Oren–Nayar energy compensation.
  • Re-enables the masonry render test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
contrib/tests/test_render_metashade.py Removes masonry from exclusions.
mx_metashade_standard_surface_bsdf_genglsl_impl.glsl Uses uncompensated Oren–Nayar diffuse.
Suppressed comments (1)

contrib/tests/metashade_ref/libraries/standard_surface/mx_metashade_standard_surface_bsdf_genglsl_impl.glsl:54

  • This implementation change is embedded into every generated Standard Surface fragment shader, but all 63 committed baselines under contrib/tests/metashade_ref/renders/standard_surface still call this function with true. In CI, test_render.py:608-609 compares generated shaders byte-for-byte and _RefDiffer fails on missing or differing baselines, so CI cannot regenerate these automatically and the affected tests will fail. Commit the regenerated shader baselines, including the newly enabled masonry shaders, with this change.
	mx_oren_nayar_diffuse_bsdf(closureData, base, coat_affected_diffuse_color, diffuse_roughness, normal, false, diffuse_bsdf);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

diffuse_bsdf.response = vec3(0.0, 0.0, 0.0);
diffuse_bsdf.throughput = vec3(1.0, 1.0, 1.0);
mx_oren_nayar_diffuse_bsdf(closureData, base, coat_affected_diffuse_color, diffuse_roughness, normal, true, diffuse_bsdf);
mx_oren_nayar_diffuse_bsdf(closureData, base, coat_affected_diffuse_color, diffuse_roughness, normal, false, diffuse_bsdf);
Update all rendered shader baselines to reflect the Qualitative
Oren-Nayar change (energy_compensation=false).  Bump metashade
submodule to metashade/metashade#229 (merged on main).

Signed-off-by: Pavlo Penenko <pavlo.penenko@autodesk.com>
@ppenenko
ppenenko marked this pull request as ready for review August 24, 2026 22:02
@ppenenko
ppenenko merged commit dc91247 into metashade/dev Aug 25, 2026
53 of 54 checks passed
@ppenenko
ppenenko deleted the metashade/fix-diffuse-energy-compensation branch August 25, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants