Skip to content

Commit

Permalink
Gooch Shader
Browse files Browse the repository at this point in the history
Resurrecting previous work by Bernard Kwok to implement Gooch shader
  • Loading branch information
ashwinbhat committed Jan 8, 2024
1 parent b48057e commit e927c21
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libraries/nprlib/nprlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
<output name="out" type="vector3" default="0.0, 0.0, 1.0" />
</nodedef>

<nodedef name="ND_gooch" node="gooch" version="1.0.0" isdefaultversion="true">
<input name="warm_color" type="color3" value="0.6, 0, 0"/>
<input name="cool_color" type="color3" value="0, 0, 0.6"/>
<input name="normal" type="vector3" defaultgeomprop="Nworld" />
<input name="light_dir" type="vector3" value="0, 1, 1"/>
<output name="out" type="surfaceshader" />
</nodedef>
</materialx>
58 changes: 58 additions & 0 deletions libraries/nprlib/nprlib_ng.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<materialx version="1.38">
<!--
Copyright Contributors to the MaterialX Project
SPDX-License-Identifier: Apache-2.0
Graph definitions of nprlib nodes included in the MaterialX specification.
-->

<nodegraph name="IMPL_gooch" nodedef="ND_gooch">
<add name="add" type="vector3" >
<input name="in1" type="vector3" nodename="light" />
<input name="in2" type="vector3" nodename="light" />
</add>
<add name="add1" type="color3" >
<input name="in1" type="color3" nodename="mix" />
<input name="in2" type="float" nodename="max1" />
</add>
<dotproduct name="dotproduct" type="float" >
<input name="in1" type="vector3" interfacename="normal" />
<input name="in2" type="vector3" nodename="normalize" />
</dotproduct>
<dotproduct name="dotproduct1" type="float" >
<input name="in1" type="vector3" interfacename="normal" />
<input name="in2" type="vector3" nodename="normalize1" />
</dotproduct>
<constant name="light" type="vector3" >
<input name="value" type="vector3" interfacename="light_dir" />
</constant>
<max name="max1" type="float" >
<input name="in1" type="float" nodename="power" />
</max>
<mix name="mix" type="color3" >
<input name="fg" type="color3" interfacename="cool_color" />
<input name="bg" type="color3" interfacename="warm_color" />
<input name="mix" type="float" nodename="dotproduct" />
</mix>
<normalize name="normalize" type="vector3" >
<input name="in" type="vector3" nodename="light" />
</normalize>
<normalize name="normalize1" type="vector3" >
<input name="in" type="vector3" nodename="add" />
</normalize>
<power name="power" type="float" >
<input name="in1" type="float" nodename="dotproduct1" />
<input name="in2" type="float" value="32" />
</power>
<uniform_edf name="uniform_edf" type="EDF" >
<input name="color" type="color3" nodename="add1" />
</uniform_edf>
<surface name="gooch_shader" type="surfaceshader" >
<input name="bsdf" type="BSDF" value="" />
<input name="edf" type="EDF" nodename="uniform_edf" />
<input name="opacity" type="float" value="1" />
</surface>
<output name="out" type="surfaceshader" nodename="gooch_shader" />
</nodegraph>
</materialx>
13 changes: 13 additions & 0 deletions resources/Materials/Examples/gooch_material.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<materialx version="1.38">

<gooch name="SR_Gooch_Material" type="surfaceshader">
<input name="warm_color" type="color3" value="0.6, 0, 0"/>
<input name="cool_color" type="color3" value="0, 0, 0.6"/>
<input name="light_dir" type="vector3" value="0, 1, 1"/>
</gooch>
<surfacematerial name="Gooch_Material" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_Gooch_Material" />
</surfacematerial>

</materialx>

0 comments on commit e927c21

Please sign in to comment.