Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple Bump node #1085

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,19 @@
<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="space" type="string" value="tangent" enum="tangent, object" uniform="true" doc="The space to transform the normal from ('tangent' or 'object'); defaults to 'tangent'" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can remove this space input, and assume the normal map is in tangent space, since the heighttonormal node is designed to generate a map in this space. In the latest draft of MaterialX 1.39, the space input has been removed from the normalmap node, so removing the input should make the bump node more forward-looking.

<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
19 changes: 19 additions & 0 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,25 @@
<!-- Geometric nodes -->
<!-- ======================================================================== -->

<nodegraph name="NG_bump_vector3" nodedef="ND_bump_vector3">
<input name="height" type="float" />
<input name="scale" type="float" />
<input name="space" type="string" />
<input name="normal" type="vector3" />
<input name="tangent" type="vector3" />
<output name="out" type="vector3" nodename="N_normalmap" />
<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="space" type="string" interfacename="space" />
<input name="scale" type="float" interfacename="scale" />
<input name="tangent" type="vector3" interfacename="tangent"/>
</normalmap>
</nodegraph>

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