Skip to content

Commit

Permalink
Consider subsurface color in dielectric albedo (#2105)
Browse files Browse the repository at this point in the history
I am experimenting with OpenPBR to UsdPreviewSurface export code in Maya and tried chaining the two translator graphs already provided in MaterialX. Results are quite good, except when the subsurface color is extremely different from the base color.

This can be fixed by computing a dielectric base albedo that mixes the scaled base color and the subsurface color.
  • Loading branch information
JGamache-autodesk authored Dec 4, 2024
1 parent bfbf672 commit f9a4222
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libraries/bxdf/translation/standard_surface_to_usd.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<input name="coat" type="float" value="0" />
<input name="coat_color" type="color3" value="1, 1, 1" />
<input name="coat_roughness" type="float" value="0.1" />
<input name="subsurface" type="float" value="0" />
<input name="subsurface_color" type="color3" value="1, 1, 1" />
<input name="emission" type="float" value="0" />
<input name="emission_color" type="color3" value="1, 1, 1" />
<input name="opacity" type="color3" value="1, 1, 1" />
Expand Down Expand Up @@ -47,13 +49,18 @@
<input name="in1" type="color3" interfacename="base_color" />
<input name="in2" type="float" interfacename="base" />
</multiply>
<mix name="albedoOpaqueDielectric" type="color3">
<input name="fg" type="color3" interfacename="subsurface_color" />
<input name="bg" type="color3" nodename="scaledBaseColor" />
<input name="mix" type="float" interfacename="subsurface" />
</mix>
<mix name="coatAttenuation" type="color3">
<input name="fg" type="color3" interfacename="coat_color" />
<input name="bg" type="color3" value="1.0, 1.0, 1.0" />
<input name="mix" type="float" interfacename="coat" />
</mix>
<multiply name="diffuseColor" type="color3">
<input name="in1" type="color3" nodename="scaledBaseColor" />
<input name="in1" type="color3" nodename="albedoOpaqueDielectric" />
<input name="in2" type="color3" nodename="coatAttenuation" />
</multiply>
<dot name="roughness" type="float">
Expand Down

0 comments on commit f9a4222

Please sign in to comment.