Skip to content

Commit

Permalink
Additional improvements to MaterialX Lama nodes (#1955)
Browse files Browse the repository at this point in the history
- Updated LamaGeneralizedSchlick implementation (changed the transmission component from a dielectric BSDF to a generalized schlick BSDF, adjusted implementation of reflectionTint)
- Updated LamaSSS and LamaTranslucent (removed LobeName and matte inputs as they are renderer-specific)
- Updated default values and help documentation of MaterialX Lama nodes to be consistent with Renderman Lama nodes.
  • Loading branch information
mkuo-lucasfilm committed Aug 7, 2024
1 parent 65dc595 commit 67702da
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 124 deletions.
18 changes: 8 additions & 10 deletions libraries/bxdf/lama/lama_conductor.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<nodedef name="ND_lama_conductor" node="LamaConductor" nodegroup="pbr" doc="Lama conductor" version="1.0" isdefaultversion="true">
<input name="tint" type="color3" value="1, 1, 1" uiname="Tint" uifolder="Main"
doc="Overall color multiplier. It should be used with parcimony, as a non-white value breaks physicality. The prefered way to define the color of a conductor is through the Fresnel attributes right below." />
<input name="fresnelMode" type="integer" uniform="true" enum="Scientific,Artistic" enumvalues="0,1" value="0" uiname="Fresnel Mode" uifolder="Main"
doc="Fresnel mode" />
<input name="fresnelMode" type="integer" uniform="true" enum="Artistic,Scientific" enumvalues="0,1" value="0" uiname="Fresnel Mode" uifolder="Main"
doc="Switches the Fresnel between Artistic and Scientific parameters. The Artistic mode offers reflectivity in the normal direction and reflectivity90 at the grazing angle. The Scientific mode provides an index of refraction for each rgb component. Note that IOR is only used to calculate the reflectivity value used by the Schlick approximation. When reflectivity90 is 1, then both modes achieve identical results, as one can be mapped to the other." />
<input name="IOR" type="vector3" value="0.180000007153,0.419999986887,1.37000000477" uiname="IOR" uifolder="Main"
doc="Index of refraction (often denoted by eta), defining the color reflected by the surface in the normal direction." />
<input name="extinction" type="vector3" value="3.42000007629,2.34999990463,1.76999998093" uiname="Extinction" uifolder="Main"
doc="Extinction coefficient (often denoted by kappa), influencing how the reflected color curve evolves between its value in the normal direction (or 0 degree), and 1 when reaching 90 degrees. A null value does not deviate the curve at all." />
<input name="reflectivity" type="color3" value="0.9450, 0.7772, 0.3737" uiname="Reflectivity" uifolder="Main"
doc="Color reflected by the surface in the normal direction." />
<input name="edgeColor" type="color3" value="0.9979, 0.9813, 0.7523" uiname="Edge Color" uifolder="Main"
<input name="edgeColor" type="color3" value="0.7137, 0.7373, 0.4550" uiname="Edge Color" uifolder="Main"
doc="Indicates how the reflected color curve evolves between its value in the normal direction (or 0 degree), and 1 when reaching 90 degrees. Note that this color is unlikely to be reached, and just bends the curve towards it when reaching grazing angles. A null value does not deviate the curve at all." />
<input name="roughness" type="float" value="0.1" uimin="0.0" uimax="1.0" uiname="Roughness" uifolder="Main"
doc="Micro-facet distribution roughness." />
Expand All @@ -21,7 +21,7 @@
doc="Defines the amount of anisotropy, changing the co-tangent axis roughness from the original value to 1 (or to 0 with a negative value)." />
<input name="anisotropyDirection" type="vector3" defaultgeomprop="Tworld" uiname="Direction" uifolder="Anisotropy"
doc="Overrides the surface tangent as the anisotropy direction." />
<input name="anisotropyRotation" type="float" value="0.0" uiname="Rotation" uifolder="Anisotropy"
<input name="anisotropyRotation" type="float" value="0.0" uisoftmin="0.0" uisoftmax="1.0" uiname="Rotation" uifolder="Anisotropy"
doc="Rotates the anisotropy direction (possibly overriden by the previous attribute) around the normal, from 0 to 360 degrees." />
<output name="out" type="BSDF" />
</nodedef>
Expand All @@ -40,13 +40,13 @@
<input name="in" type="vector3" interfacename="extinction" />
</convert>
<switch name="eta_switch" type="color3">
<input name="in1" type="color3" nodename="convert_ior" />
<input name="in2" type="color3" nodename="artistic_ior" output="ior" />
<input name="in1" type="color3" nodename="artistic_ior" output="ior" />
<input name="in2" type="color3" nodename="convert_ior" />
<input name="which" type="integer" interfacename="fresnelMode" />
</switch>
<switch name="kappa_switch" type="color3">
<input name="in1" type="color3" nodename="convert_extinction" />
<input name="in2" type="color3" nodename="artistic_ior" output="extinction" />
<input name="in1" type="color3" nodename="artistic_ior" output="extinction" />
<input name="in2" type="color3" nodename="convert_extinction" />
<input name="which" type="integer" interfacename="fresnelMode" />
</switch>

Expand Down Expand Up @@ -110,8 +110,6 @@
<input name="distribution" type="string" value="ggx" />
</conductor_bsdf>

<!-- Layered BRDF -->

<!-- Tinted BRDF -->
<multiply name="tinted_bsdf" type="BSDF">
<input name="in1" type="BSDF" nodename="conductor_bsdf" />
Expand Down
24 changes: 12 additions & 12 deletions libraries/bxdf/lama/lama_dielectric.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
doc="Color multiplier for external reflection. It should be used with parcimony, as a non-white value breaks physicality." />
<input name="transmissionTint" type="color3" value="1.0, 1.0, 1.0" uiname="Transmission Tint" uifolder="Main"
doc="Color multiplier for rays going inside the medium (covers external transmission and internal reflection). It should be used with parcimony, as a non-white value breaks physicality. The prefered way to define the color of a dielectric is through the Interior attributes right below." />
<input name="fresnelMode" type="integer" uniform="true" enum="Scientific,Artistic" enumvalues="0,1" value="0" uiname="Fresnel Mode" uifolder="Main"
doc="Fresnel mode" />
<input name="fresnelMode" type="integer" uniform="true" enum="Artistic,Scientific" enumvalues="0,1" value="0" uiname="Fresnel Mode" uifolder="Main"
doc="Switches the Fresnel parameterization between Artistic and Scientific mode. The Artistic mode offers a scalar value defining the reflectivity in the normal direction. The Scientific mode proposes an index of refraction. Both parameterizations can achieve identical results, as one can be mapped to the other." />
<input name="IOR" type="float" value="1.5" uimin="1.0" uimax="3.0" uiname="IOR" uifolder="Main"
doc="Index of refraction (often denoted by eta), defining the amount reflected by the surface in the normal direction, and how the rays are bent by refraction." />
<input name="reflectivity" type="float" value="0.04" uiname="Reflectivity" uifolder="Main"
doc="Reflectivity" />
<input name="reflectivity" type="float" value="0.04" uimin="0.0" uimax="1.0" uisoftmin="0.0" uisoftmax="0.25" uiname="Reflectivity" uifolder="Main"
doc="Amount reflected by the surface in the normal direction. Also affects how the rays are bent by refraction." />
<input name="roughness" type="float" value="0.1" uimin="0.0" uimax="1.0" uiname="Roughness" uifolder="Main"
doc="Micro-facet distribution roughness." />
<input name="normal" type="vector3" defaultgeomprop="Nworld" uiname="Normal" uifolder="Main"
Expand All @@ -19,16 +19,16 @@
doc="Defines the amount of anisotropy, changing the co-tangent axis roughness from the original value to 1 (or to 0 with a negative value)." />
<input name="direction" type="vector3" defaultgeomprop="Tworld" uiname="Direction" uifolder="Anisotropy"
doc="Overrides the surface tangent as the anisotropy direction." />
<input name="rotation" type="float" value="0.0" uiname="Rotation" uifolder="Anisotropy"
<input name="rotation" type="float" value="0.0" uisoftmin="0.0" uisoftmax="1.0" uiname="Rotation" uifolder="Anisotropy"
doc="Rotates the anisotropy direction (possibly overriden by the previous attribute) around the normal, from 0 to 360 degrees." />
<input name="absorptionColor" type="color3" value="1.0, 1.0, 1.0" uiname="Absorption Color" uifolder="Interior"
doc="Absorption color" />
<input name="absorptionRadius" type="float" value="1.0" uiname="Absorption Radius" uifolder="Interior"
doc="Absorption radius" />
doc="Interior volume absorption color. It is defined as the negative logarithm of the extinction coefficient, with values between 0 and 1, such that the object itself and its shadows are tinted proportionnally. If set to 1, there is no absorption, and if set to 0, the object will be completely opaque. Note that for single scattering to kick in, the value must be inferior to 1. This value will also act as coating color, when this node is used as the top material in a layer node." />
<input name="absorptionRadius" type="float" value="1.0" uimin="0.0" uiname="Absorption Radius" uifolder="Interior"
doc="Distance, in world space units, at which the Absorption Color is assumed to be reached. Can be used to control the rate of absorption." />
<input name="scatterColor" type="color3" value="0.0, 0.0, 0.0" uiname="Scatter Color" uifolder="Interior"
doc="Scatter color" />
doc="Color (aka scattering albedo) of the medium, defines what proportion of the light hitting volumetric particles is scattered around by the phase function (as opposed to just absorbed), for each color channel. Only takes effect if the corresponding channel has a non-null density, in other words if the Absorption Color value for that channel is inferior to 1." />
<input name="scatterAnisotropy" type="float" value="0.0" uimin="-1.0" uimax="1.0" uiname="Scatter Anisotropy" uifolder="Interior"
doc="Scatter anisotropy" />
doc="Anisotropy of the medium's phase function, ranging from full backward scattering at -1 to forward scattering at 1. Only takes effect if the Scatter Color is non-null." />
<output name="out" type="BSDF" />
</nodedef>

Expand All @@ -47,8 +47,8 @@
<input name="index" type="integer" value="0" />
</extract>
<switch name="fresnel_mode_switch" type="float">
<input name="in1" type="float" interfacename="IOR" />
<input name="in2" type="float" nodename="ior_float" />
<input name="in1" type="float" nodename="ior_float" />
<input name="in2" type="float" interfacename="IOR" />
<input name="which" type="integer" interfacename="fresnelMode" />
</switch>

Expand Down
2 changes: 1 addition & 1 deletion libraries/bxdf/lama/lama_emission.mtlx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<materialx version="1.39" colorspace="acescg">
<nodedef name="ND_lama_emission" node="LamaEmission" nodegroup="pbr" doc="Lama emission" version="1.0" isdefaultversion="true">
<input name="color" type="color3" value="1.0, 1.0, 1.0" uiname="Color" uifolder="Main"
<input name="color" type="color3" value="0.0, 0.0, 0.0" uiname="Color" uifolder="Main"
doc="Color being uniformly emitted in all directions above the surface." />
<output name="out" type="EDF" />
</nodedef>
Expand Down
Loading

0 comments on commit 67702da

Please sign in to comment.