Skip to content

Commit

Permalink
Add an upstream graph to compute warm / cool colours based on math in…
Browse files Browse the repository at this point in the history
… Gooch98 paper.

Any warm or cool colour computation could be connected.
  • Loading branch information
kwokcb committed Jan 29, 2024
1 parent 18aeca8 commit 17fd1b7
Showing 1 changed file with 52 additions and 3 deletions.
55 changes: 52 additions & 3 deletions resources/Materials/TestSuite/nprlib/gooch_shade.mtlx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<materialx version="1.38">
<gooch_shade name="default_gooch" type="color3" />
<gooch_shade name="default_gooch" type="color3">
<input name="shininess" type="float" value="32" />
</gooch_shade>
<surface_unlit name="unlit_surface" type="surfaceshader">
<input name="emission_color" type="color3" nodename="default_gooch" />
<input name="opacity" type="float" value="1.0" />
Expand All @@ -12,9 +14,9 @@
<gooch_shade name="red_blue_gooch" type="color3">
<input name="warm_color" type="color3" value="1, 0, 0" />
<input name="cool_color" type="color3" value="0, 2.38419e-07, 1" />
<input name="specular_intensity" type="float" value="0.5" />
<input name="specular_intensity" type="float" value="0.999" />
<input name="shininess" type="float" value="32" />
<input name="light_direction" type="vector3" value="-1, -0.5, -0.5" />
<input name="light_direction" type="vector3" value="1, -0.5, -0.5" />
</gooch_shade>
<surface_unlit name="unlit_surface2" type="surfaceshader">
<input name="emission_color" type="color3" nodename="red_blue_gooch" />
Expand All @@ -24,4 +26,51 @@
<input name="surfaceshader" type="surfaceshader" nodename="unlit_surface2" />
<input name="displacementshader" type="displacementshader" value="" />
</surfacematerial>
<nodegraph name="NG_gooch_warm_cool" type="color3">
<input name="diffuse_color" type="color3" value="1, 1, 1" doc="Diffuse Color" uiname="Diffuse Color" />
<input name="blue_tone" type="float" value="0.4" uimin="0" uimax="1" doc="Blue tone" uiname="Blue Tone" />
<input name="yellow_tone" type="float" value="0.4" uimin="0" uimax="1" doc="Yellow Tone" uiname="Yellow Tone" />
<input name="diffuse_blue_strength" type="float" value="0.2" uimin="0" uimax="1" doc="Diffuse Blue Strength" uiname="Diffuse Blue Strength" />
<input name="diffuse_yellow_strength" type="float" value="0.6" doc="Luminance Shift" uiname="Diffuse Yellow Strength" />
<swizzle name="swizzle_float_color3" type="color3">
<input name="in" type="float" interfacename="blue_tone" />
<input name="channels" type="string" value="00b" />
</swizzle>
<swizzle name="swizzle_float_color4" type="color3">
<input name="in" type="float" interfacename="yellow_tone" />
<input name="channels" type="string" value="rg0" />
</swizzle>
<add name="k_cool" type="color3">
<input name="in1" type="color3" nodename="multiply_color3FA3" />
<input name="in2" type="color3" nodename="swizzle_float_color3" />
</add>
<add name="k_warm" type="color3">
<input name="in2" type="color3" nodename="swizzle_float_color4" />
<input name="in1" type="color3" nodename="multiply_color3FA2" />
</add>
<multiply name="multiply_color3FA2" type="color3">
<input name="in2" type="float" interfacename="diffuse_yellow_strength" />
<input name="in1" type="color3" interfacename="diffuse_color" />
</multiply>
<multiply name="multiply_color3FA3" type="color3">
<input name="in1" type="color3" interfacename="diffuse_color" />
<input name="in2" type="float" interfacename="diffuse_blue_strength" />
</multiply>
<output name="out_cool" type="color3" nodename="k_cool" />
<output name="out_warm" type="color3" nodename="k_warm" />
</nodegraph>
<gooch_shade name="gooch_shad3e" type="color3">
<input name="cool_color" type="color3" output="out_cool" nodegraph="NG_gooch_warm_cool" />
<input name="warm_color" type="color3" output="out_warm" nodegraph="NG_gooch_warm_cool" />
<input name="light_direction" type="vector3" value="1, -0.5, -0.5" />
<input name="shininess" type="float" value="32" />
</gooch_shade>
<surface_unlit name="unlit_surface3" type="surfaceshader">
<input name="emission_color" type="color3" nodename="gooch_shad3e" />
<input name="opacity" type="float" value="1.0" />
</surface_unlit>
<surfacematerial name="surfacematerial3" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="unlit_surface3" />
<input name="displacementshader" type="displacementshader" value="" />
</surfacematerial>
</materialx>

0 comments on commit 17fd1b7

Please sign in to comment.