Skip to content

Commit

Permalink
Add a simple Bump node (#1085)
Browse files Browse the repository at this point in the history
This adds a MtlX Bump node. It simplifies adding bump to shaders by wrapping up the necessary nodes, which helps artists using MaterialX. Having a node called 'bump' also makes it easier to discover.
  • Loading branch information
crydalch authored Oct 25, 2022
1 parent bb2d4c2 commit 869ffe2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,18 @@
<output name="out" type="vector4" default="0.0, 0.0, 0.0, 0.0" />
</nodedef>

<!--
Node: <bump>
Offset the surface normal by a scalar value.
-->
<nodedef name="ND_bump_vector3" node="bump" nodegroup="geometric">
<input name="height" type="float" uiname="Height" uisoftmin="0.0" uisoftmax="1.0" value="0" doc="Amount to offset the surface normal." />
<input name="scale" type="float" uiname="Scale" uisoftmin="0.0" uisoftmax="1.0" value="1" doc="Scalar to adjust the height amount." />
<input name="normal" type="vector3" uiname="Normal" defaultgeomprop="Nworld" doc="Surface normal; defaults to the current world-space normal." />
<input name="tangent" type="vector3" uiname="Tangent" defaultgeomprop="Tworld" doc="Surface tangent vector, defaults to the current world-space tangent vector." />
<output name="out" type="vector3" doc="Offset surface normal; connect this to a shader's 'normal' input." />
</nodedef>

<!-- ======================================================================== -->
<!-- Global nodes -->
<!-- ======================================================================== -->
Expand Down
13 changes: 13 additions & 0 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,19 @@
<!-- Geometric nodes -->
<!-- ======================================================================== -->

<nodegraph name="NG_bump_vector3" nodedef="ND_bump_vector3">
<heighttonormal name="N_heighttonormal" type="vector3">
<input name="in" type="float" interfacename="height" />
</heighttonormal>
<normalmap name="N_normalmap" type="vector3">
<input name="in" type="vector3" nodename="N_heighttonormal" />
<input name="normal" type="vector3" interfacename="normal" />
<input name="scale" type="float" interfacename="scale" />
<input name="tangent" type="vector3" interfacename="tangent"/>
</normalmap>
<output name="out" type="vector3" nodename="N_normalmap" />
</nodegraph>

<!-- ======================================================================== -->
<!-- Global nodes -->
<!-- ======================================================================== -->
Expand Down

0 comments on commit 869ffe2

Please sign in to comment.