Skip to content

Commit

Permalink
Fix opacity edge case in UsdPreviewSurface (#1186)
Browse files Browse the repository at this point in the history
This changelist fixes an edge case for the opacity computation in UsdPreviewSurface, making surfaces visible when their non-zero opacity is exactly equal to the opacity threshold.

This aligns the MaterialX graph for UsdPreviewSurface with its specification (https://graphics.pixar.com/usd/release/spec_usdpreviewsurface.html), which states:

"... when opacityThreshold is greater than zero, the opacity values less than the opacityThreshold will not be rendered, and the opacity values greater than or equal to the opacityThreshold will be fully visible."
  • Loading branch information
jstone-lucasfilm committed Jan 4, 2023
1 parent b926669 commit 01fc05f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/bxdf/usd_preview_surface.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@
<input name="low" type="float" value="0.00001" />
<input name="high" type="float" value="1.0" />
</clamp>
<ifgreater name="cutout_opacity" type="float">
<ifgreatereq name="cutout_opacity" type="float">
<input name="value1" type="float" nodename="opacity_clamped" />
<input name="value2" type="float" interfacename="opacityThreshold" />
<input name="in1" type="float" value="1" />
<input name="in2" type="float" value="0" />
</ifgreater>
</ifgreatereq>
<surface name="surface_constructor" type="surfaceshader">
<input name="bsdf" type="BSDF" nodename="coat_bsdf" />
<input name="edf" type="EDF" nodename="emission_edf" />
Expand Down

0 comments on commit 01fc05f

Please sign in to comment.