Skip to content

Commit

Permalink
Normals Fixes (#1402)
Browse files Browse the repository at this point in the history
Adding defaultgeomprop attributes
Unifying default values for vector3 inputs
Fixing wrong normal conversion in Glass graph
Fixing wrong default normal constant in Generic graph
  • Loading branch information
zicher3d authored Jun 27, 2024
1 parent fd8260e commit e9c7668
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
70 changes: 35 additions & 35 deletions contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- <Conversion of Tangent Normal to Phi and Theta Spherical Coordinates> -->
<nodedef name="ND_norm2spherical" node="norm2spherical" version="1.0" isdefaultversion="true" nodegroup="adsk_legacy" >
<input name="normal" type="vector3" value="0,0,1"/>
<input name="normal" type="vector3" value="0, 0, 1"/>
<output name="phi" type="float" />
<output name="theta" type="float" />
</nodedef>
Expand All @@ -35,8 +35,8 @@

<!-- <Combines Two Tangent Normals into a new Tangent Normal> -->
<nodedef name="ND_combinenormals_vector3" node="combinenormals_vector3" version="1.0" isdefaultversion="true" nodegroup="adsk_legacy" >
<input name="normal1" type="vector3" value="0,0,1" />
<input name="normal2" type="vector3" value="0,0,1" />
<input name="normal1" type="vector3" value="0, 0, 1" />
<input name="normal2" type="vector3" value="0, 0, 1" />
<input name="weight" type="float" value="1" uimin="0" uimax="1" />
<output name="out" type="vector3" />
</nodedef>
Expand Down Expand Up @@ -117,9 +117,9 @@
<input name="tint_enable" type="boolean" value="false" uivisible="true" uiname="Tint" />
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="finish_bump_enable" type="boolean" value="false" uivisible="true" uiname="Finish Bump" />
<input name="finish_bump" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Finish Bump" />
<input name="finish_bump" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Finish Bump" defaultgeomprop="Nworld" />
<input name="relief_pattern_enable" type="boolean" value="false" uivisible="true" uiname="Relief Pattern" />
<input name="relief_pattern" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief Pattern" />
<input name="relief_pattern" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief Pattern" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -134,7 +134,7 @@
<input name="tint_color" type="color3" value="0.1075, 0.6597, 0.0136" uivisible="true" uiname="Tint Color" />
<input name="relief_pattern_enable" type="boolean" value="false" uivisible="true" uiname="Relief Pattern" />
<input name="relief_pattern_type" type="float" value="0" uivisible="true" uiname="Relief Pattern Type" enum="Based on Wood Grain,Custom" enumvalues="0,1" uimin="0" uimax="1" />
<input name="relief_pattern_custom" type="vector3" value="0,0,1" uivisible="true" uiname="Custom Relief Pattern" />
<input name="relief_pattern_custom" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief Pattern" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -160,17 +160,17 @@
<input name="patina" type="float" value="0" uivisible="true" uiname="Patina" />
<input name="relief_enable" type="boolean" value="false" uivisible="true" uiname="Relief" />
<input name="relief" type="float" value="0" uivisible="true" uiname="Relief Type" enum="Knurl,Diamond Plate,Checker Plate,Custom" enumvalues="0,1,2,3" uimin="0" uimax="3" />
<input name="custom_relief" type="vector3" value="0, 0, 0" uivisible="true" uiname="Custom Relief" />
<input name="custom_relief" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief" defaultgeomprop="Nworld" />
<input name="cutout_enable" type="boolean" value="false" uivisible="true" uiname="Cutout" />
<input name="cutout" type="float" value="0" uivisible="true" uiname="Cutout Type" enum="Circles,Staggered Circles,Squares,Staggered Squares,Hexagons,Grecian,Cloverleaf,Custom" enumvalues="0,1,2,3,4,5,6,7" uimin="0" uimax="7" />
<input name="cutout_size" type="float" value="0.1" uivisible="true" uiname="Cutout Size" />
<input name="cutout_spacing" type="float" value="0.5" uivisible="true" uiname="Cutout Spacing" uimin="0" uimax="1" />
<input name="custom_cutout" type="color3" value="1, 1, 1" uivisible="true" uiname="Custom Cutout" />
<input name="tint_enable" type="boolean" value="false" uivisible="true" uiname="Tint" />
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="normal_knurl" type="vector3" uivisible="false" />
<input name="normal_diamondplate" type="vector3" uivisible="false" />
<input name="normal_checkerplate" type="vector3" uivisible="false" />
<input name="normal_knurl" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="normal_diamondplate" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="normal_checkerplate" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -193,11 +193,11 @@
<input name="finish_bump" type="float" value="0" uivisible="true" uiname="Finish Bump" enum="Broom Straight,Broom Curved,Smooth,Polished,Stamped/Custom" enumvalues="0,1,2,3,4" uimin="0" uimax="4" />
<input name="tint_enable" type="boolean" value="false" uivisible="true" uiname="Tint" />
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="bump_broomstraight" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_broomcurved" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_smooth" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_polished" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_custom" type="vector3" value="0, 0, 0" uivisible="true" uiname="Custom Bump" />
<input name="bump_broomstraight" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_broomcurved" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_smooth" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_polished" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_custom" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Bump" defaultgeomprop="Nworld" />
<input name="weathering_enable" type="boolean" value="false" uivisible="true" uiname="Weathering" />
<input name="weathering_type" type="float" value="0" uivisible="true" uiname="Weathering Type" enum="Automatic,Custom" enumvalues="0,1" uimin="0" uimax="1" />
<input name="weathering_custom" type="color3" value="1, 1, 1" uivisible="true" uiname="Custom Weathering" />
Expand All @@ -212,9 +212,9 @@
<input name="application" type="float" value="0" uivisible="true" uiname="Application" enum="Roller,Brush,Spray" enumvalues="0,1,2" uimin="0" uimax="2" />
<input name="tint_enable" type="boolean" value="false" uivisible="true" uiname="Tint" />
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="normal_roller" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="normal_brush" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="normal_spray" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="normal_roller" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="normal_brush" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="normal_spray" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -227,9 +227,9 @@
<input name="finish" type="float" value="0" uivisible="true" uiname="Finish" enum="High Gloss-Glazed,Satin,Matte" enumvalues="0,1,2" uimin="0" uimax="2" />
<input name="finish_bump_enable" type="boolean" value="false" uivisible="true" uiname="Finish Bump" />
<input name="finish_bump" type="float" value="0" uivisible="true" uiname="Finish Bump Type" enum="Wavy,Custom" enumvalues="0,1" uimin="0" uimax="1" />
<input name="custom_finish_normal" type="vector3" value="0,0,0" uivisible="true" uiname="Custom Finish Bump" />
<input name="custom_finish_normal" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Finish Bump" defaultgeomprop="Nworld" />
<input name="relief_pattern_enable" type="boolean" value="false" uivisible="true" uiname="Relief Pattern" />
<input name="relief_pattern_normal" type="vector3" value="0,0,0" uivisible="true" uiname="Custom Relief Pattern" />
<input name="relief_pattern_normal" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief Pattern" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -246,9 +246,9 @@
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="relief_enable" type="boolean" value="false" uivisible="true" uiname="Relief" />
<input name="relief_type" type="float" value="0" uivisible="true" uiname="Relief Type" enum="Rippled,Wavy,Custom" enumvalues="0,1,2" uimin="0" uimax="2"/>
<input name="normal_rippled" type="vector3" value="0.5,0.5,1.0" uivisible="false" />
<input name="normal_wavy" type="vector3" value="0.5,0.5,1.0" uivisible="false" />
<input name="custom_relief" type="vector3" value="0.5,0.5,1.0" uivisible="true" uiname="Custom Relief" />
<input name="normal_rippled" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="normal_wavy" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="custom_relief" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -260,11 +260,11 @@
<input name="custom_color" type="color3" value="0.8, 0.8, 0.8" uivisible="true" uiname="Custom Color" />
<input name="tint_enable" type="boolean" value="false" uivisible="true" uiname="Tint" />
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="bump_swimming_pool" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_generic_refl_pool" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_generic_stream" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_generic_pond" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_generic_sea" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="bump_swimming_pool" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_generic_refl_pool" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_generic_stream" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_generic_pond" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="bump_generic_sea" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -276,12 +276,12 @@
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="finish_bump_enable" type="boolean" value="false" uivisible="true" uiname="Finish Bump" />
<input name="finish_bump" type="float" value="2" uivisible="true" uiname="Finish Bump Type" enum="Polished Granite,Stone Wall,Glossy Marble,Custom" enumvalues="0,1,2,3" uimin="0" uimax="3"/>
<input name="finish_granite" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="finish_marble" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="finish_wall" type="vector3" value="0, 0, 0" uivisible="false" />
<input name="custom_finish" type="vector3" value="0, 0, 0" uivisible="true" uiname="Custom Finish Bump" />
<input name="finish_granite" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="finish_marble" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="finish_wall" type="vector3" value="0, 0, 1" uivisible="false" defaultgeomprop="Nworld" />
<input name="custom_finish" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Finish Bump" defaultgeomprop="Nworld" />
<input name="relief_pattern_enable" type="boolean" value="false" uivisible="true" uiname="Relief Pattern" />
<input name="relief_pattern" type="vector3" value="0, 0, 0" uivisible="true" uiname="Custom Relief Pattern" />
<input name="relief_pattern" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief Pattern" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -293,7 +293,7 @@
<input name="tint_color" type="color3" value="1, 1, 1" uivisible="true" uiname="Tint Color" />
<input name="finish" type="float" value="0" uivisible="true" uiname="Finish" enum="Glossy,Matte,Unfinished" enumvalues="0,1,2" uimin="0" uimax="2" />
<input name="relief_enable" type="boolean" value="false" uivisible="true" uiname="Relief" />
<input name="relief_image" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief" />
<input name="relief_image" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Relief" defaultgeomprop="Nworld" />
<output name="out" type="surfaceshader" />
</nodedef>

Expand All @@ -318,7 +318,7 @@
<input name="custom_refraction" type="float" value="1.5" uivisible="true" uiname="Custom Refraction IOR" uimin="1" uimax="10" />
<input name="translucency" type="float" value="0" uivisible="true" uiname="Translucency" />
<input name="bump_enable" type="boolean" value="false" uivisible="true" uiname="Bump" />
<input name="bump" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Bump" />
<input name="bump" type="vector3" value="0, 0, 1" uivisible="true" uiname="Custom Bump" defaultgeomprop="Nworld" />
<input name="cutout_enable" type="boolean" value="false" uivisible="true" uiname="Cutout" />
<input name="cutout_image" type="color3" value="1, 1, 1" uivisible="true" uiname="Custom Cutout" />
<input name="emission_enable" type="boolean" value="false" uivisible="true" uiname="Emission" />
Expand Down
14 changes: 8 additions & 6 deletions contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@
<input name="specular_IOR" type="float" nodename="switch_ior" uivisible="true" />
<input name="transmission" type="float" value="1" uivisible="true" />
<input name="transmission_color" type="color3" nodename="tint_selection" uivisible="true" />
<input name="normal" type="vector3" nodename="normalmap" />
<input name="normal" type="vector3" nodename="ifequal_vector3B" />
</standard_surface>
<remap name="refl_extra" type="float" xpos="5.152174" ypos="-5.362069">
<input name="in" type="float" interfacename="reflectance" uivisible="true" />
Expand Down Expand Up @@ -1692,11 +1692,11 @@
<srgb_texture_to_lin_rec709 name="srgb_texture_to_lin_rec709_color3" type="color3" xpos="2.630435" ypos="-12.689655">
<input name="in" type="color3" nodename="switch_color" />
</srgb_texture_to_lin_rec709>
<normalmap name="normalmap" type="vector3" xpos="7.623188" ypos="12.543103">
<input name="in" type="vector3" nodename="ifequal_vector3B" />
<normalmap name="normalmap" type="vector3" xpos="2.094203" ypos="14.336206">
<input name="in" type="vector3" nodename="constant_no_relief" />
</normalmap>
<ifequal name="ifequal_vector3B" type="vector3" xpos="3.768116" ypos="11.870689">
<input name="in2" type="vector3" nodename="constant_no_relief" />
<ifequal name="ifequal_vector3B" type="vector3" xpos="5.507246" ypos="11.784483">
<input name="in2" type="vector3" nodename="normalmap" />
<input name="value2" type="boolean" value="true" />
<input name="value1" type="boolean" interfacename="relief_enable" />
<input name="in1" type="vector3" nodename="switch_vector3" />
Expand Down Expand Up @@ -2209,7 +2209,9 @@
<input name="in1" type="vector3" interfacename="bump" />
<input name="in2" type="vector3" nodename="neutral_normalmap" />
</ifequal>
<constant name="neutral_normal" type="vector3" xpos="3.224638" ypos="39.646553" />
<constant name="neutral_normal" type="vector3" xpos="3.224638" ypos="39.646553">
<input name="value" type="vector3" value="0.5, 0.5, 1" />
</constant>
<normalmap name="neutral_normalmap" type="vector3" xpos="5.768116" ypos="39.663792">
<input name="in" type="vector3" nodename="neutral_normal" />
</normalmap>
Expand Down

0 comments on commit e9c7668

Please sign in to comment.