Skip to content

Commit

Permalink
- Fix light direction (should be inverted).
Browse files Browse the repository at this point in the history
- Fix warm and cool colours (was swapped)
  • Loading branch information
kwokcb committed Jan 27, 2024
1 parent 068d7ce commit 6a94169
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/nprlib/nprlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<input name="cool_color" type="color3" value="0, 0, 0.6" uiname="Cool Color" doc="Cool diffuse color"/>
<input name="shininess" type="float" value="8" uimin="1" uimax="64" doc="Specular shininess"/>
<input name="specular_color" type="color3" value="0.6, 0.6, 0.6" uiname="Specular Color" doc="Specular color"/>
<input name="light_direction" type="vector3" value="1, 0.5, 0.5" uiname="Light Direction" doc="Light vector"/>
<input name="light_direction" type="vector3" value="1, -0.5, -0.5" uiname="Light Direction" doc="Light vector in world space"/>
<output name="out" type="color3" />
</nodedef>

Expand Down
10 changes: 7 additions & 3 deletions libraries/nprlib/nprlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
<input name="space" type="string" value="world" />
</normal>
<normalize name="normalized_light_dir" type="vector3">
<input name="in" type="vector3" interfacename="light_direction" />
<input name="in" type="vector3" nodename="invert_light_dir" />
</normalize>
<dotproduct name="NdotL" type="float">
<input name="in1" type="vector3" nodename="N" />
<input name="in2" type="vector3" nodename="normalized_light_dir" />
</dotproduct>
<mix name="diffuse" type="color3">
<input name="fg" type="color3" interfacename="cool_color" />
<input name="bg" type="color3" interfacename="warm_color" />
<input name="fg" type="color3" interfacename="warm_color" />
<input name="bg" type="color3" interfacename="cool_color" />
<input name="mix" type="float" nodename="max_float" />
</mix>
<power name="specular" type="float">
Expand Down Expand Up @@ -114,6 +114,10 @@
<input name="in1" type="color3" nodename="diffuse" />
<input name="in2" type="color3" nodename="multiply_color3FA" />
</add>
<multiply name="invert_light_dir" type="vector3">
<input name="in1" type="vector3" interfacename="light_direction" />
<input name="in2" type="vector3" value="-1, -1, -1" />
</multiply>
<output name="out" type="color3" nodename="final_color" />
</nodegraph>

Expand Down

0 comments on commit 6a94169

Please sign in to comment.