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

Adds Random Float and Random Color nodes #1330

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
46 changes: 46 additions & 0 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,52 @@
<output name="out" type="float" />
</nodedef>

<!--
Node: <randomfloat>
Produces a randomized float, based on an 'input' signal and 'seed' value.
-->
<nodedef name="ND_randomfloat_float" node="randomfloat" nodegroup="procedural">
<input name="in" type="float" uiname="Input" value="0.0" doc="Initial randomization seed." />
<input name="min" type="float" uiname="Minimum" value="0.0" doc="The minimum output value." />
<input name="max" type="float" uiname="Maximum" value="1.0" doc="The maximum output value." />
<input name="seed" type="integer" uiname="Seed" value="0" doc="Additional seed." />
<output name="out" type="float" />
</nodedef>
<nodedef name="ND_randomfloat_integer" node="randomfloat" nodegroup="procedural">
<input name="in" type="integer" uiname="Input" value="0" />
<input name="min" type="float" uiname="Minimum" value="0.0" />
<input name="max" type="float" uiname="Maximum" value="1.0" />
<input name="seed" type="integer" uiname="Seed" value="0" />
<output name="out" type="float" />
</nodedef>

<!--
Node: <randomcolor>
Produces a randomized RGB color, based on an 'input' signal and 'seed' value.
-->
<nodedef name="ND_randomcolor_float" node="randomcolor" nodegroup="procedural3d">
<input name="in" type="float" uiname="Input" uisoftmin="0.0" uisoftmax="10.0" value="0.0" />
<input name="huelow" type="float" uiname="Hue Low" uisoftmin="0.0" uisoftmax="1.0" value="0" />
<input name="huehigh" type="float" uiname="Hue High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="saturationlow" type="float" uiname="Saturation Low" uisoftmin="0.0" uisoftmax="1.0" value="0.825" />
<input name="saturationhigh" type="float" uiname="Saturation High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="brightnesslow" type="float" uiname="Brightness Low" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="brightnesshigh" type="float" uiname="Brightness High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="seed" type="integer" uiname="Seed" value="0" />
<output name="out" type="color3" />
</nodedef>
<nodedef name="ND_randomcolor_integer" node="randomcolor" nodegroup="procedural3d">
<input name="in" type="integer" uiname="Input" uisoftmin="0" uisoftmax="10" value="0" />
<input name="huelow" type="float" uiname="Hue Low" uisoftmin="0.0" uisoftmax="1.0" value="0" />
<input name="huehigh" type="float" uiname="Hue High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="saturationlow" type="float" uiname="Saturation Low" uisoftmin="0.0" uisoftmax="1.0" value="0.825" />
<input name="saturationhigh" type="float" uiname="Saturation High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="brightnesslow" type="float" uiname="Brightness Low" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="brightnesshigh" type="float" uiname="Brightness High" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="seed" type="integer" uiname="Seed" value="0" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <checkerboard>
A 2D checkerboard pattern.
Expand Down
137 changes: 137 additions & 0 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,143 @@
<output name="out" type="float" nodename="N_range" />
</nodegraph>

<!--
Node: <randomfloat>
Produces a randomized float, based on an 'input' signal and 'seed' value.
-->
<nodegraph name="NG_randomfloat_float" nodedef="ND_randomfloat_float">
<convert name="N_convertSeed1" type="float">
<input name="in" type="integer" interfacename="seed" />
</convert>
<modulo name="N_moduloInput" type="float">
<input name="in1" type="float" interfacename="in" />
<input name="in2" type="float" value="4219" />
</modulo>
<multiply name="N_scaleInput" type="float">
<input name="in1" type="float" nodename="N_moduloInput" />
<input name="in2" type="float" value="3947" />
</multiply>
<combine2 name="N_combine2" type="vector2">
<input name="in1" type="float" nodename="N_scaleInput" />
<input name="in2" type="float" nodename="N_convertSeed1" />
</combine2>
<cellnoise2d name="N_cellnoise1" type="float">
<input name="texcoord" type="vector2" nodename="N_combine2" />
</cellnoise2d>
<range name="N_remapRange" type="float">
<input name="in" type="float" nodename="N_cellnoise1" />
<input name="outlow" type="float" interfacename="min" />
<input name="outhigh" type="float" interfacename="max" />
<input name="doclamp" type="boolean" value="true" />
</range>
<output name="out" type="float" nodename="N_remapRange" />
</nodegraph>
<nodegraph name="NG_randomfloat_integer" nodedef="ND_randomfloat_integer">
<convert name="N_convertInput1" type="float">
<input name="in" type="integer" interfacename="in" />
</convert>
<convert name="N_convertSeed1" type="float">
jstone-lucasfilm marked this conversation as resolved.
Show resolved Hide resolved
<input name="in" type="integer" interfacename="seed" />
</convert>
<combine2 name="N_combine2" type="vector2">
<input name="in1" type="float" nodename="N_convertInput1" />
<input name="in2" type="float" nodename="N_convertSeed1" />
</combine2>
<cellnoise2d name="N_cellnoise1" type="float">
<input name="texcoord" type="vector2" nodename="N_combine2" />
</cellnoise2d>
<range name="N_remapRange" type="float">
<input name="in" type="float" nodename="N_cellnoise1" />
<input name="outlow" type="float" interfacename="min" />
<input name="outhigh" type="float" interfacename="max" />
<input name="doclamp" type="boolean" value="true" />
</range>
<output name="out" type="float" nodename="N_remapRange" />
</nodegraph>

<!--
Node: <randomcolor>
Produces a randomized color, based on an input signal and seed value.
-->
<nodegraph name="NG_randomcolor_float" nodedef="ND_randomcolor_float">
<convert name="N_convertSeed1" type="float">
<input name="in" type="integer" interfacename="seed" />
</convert>
<add name="N_offset_hue" type="float">
<input name="in1" type="float" nodename="N_convertSeed1" />
<input name="in2" type="float" value="413.3" />
</add>
<add name="N_offset_saturation" type="float">
<input name="in1" type="float" nodename="N_convertSeed1" />
<input name="in2" type="float" value="1522.4" />
</add>
<add name="N_offset_brightness" type="float">
<input name="in1" type="float" nodename="N_convertSeed1" />
<input name="in2" type="float" value="1813.8" />
</add>
<ceil name="N_seed_hue" type="integer">
<input name="in" type="float" nodename="N_offset_hue" />
</ceil>
<ceil name="N_seed_saturation" type="integer">
<input name="in" type="float" nodename="N_offset_saturation" />
</ceil>
<ceil name="N_seed_brightness" type="integer">
<input name="in" type="float" nodename="N_offset_brightness" />
</ceil>
<randomfloat name="N_rand_hue" type="float">
<input name="in" type="float" interfacename="in" />
<input name="seed" type="integer" nodename="N_seed_hue" />
</randomfloat>
<randomfloat name="N_rand_saturation" type="float">
<input name="in" type="float" interfacename="in" />
<input name="seed" type="integer" nodename="N_seed_saturation" />
</randomfloat>
<randomfloat name="N_rand_brightness" type="float">
<input name="in" type="float" interfacename="in" />
<input name="seed" type="integer" nodename="N_seed_brightness" />
</randomfloat>
<range name="N_range_hue" type="float">
<input name="in" type="float" nodename="N_rand_hue" />
<input name="outlow" type="float" interfacename="huelow" />
<input name="outhigh" type="float" interfacename="huehigh" />
</range>
<range name="N_range_saturation" type="float">
<input name="in" type="float" nodename="N_rand_saturation" />
<input name="outlow" type="float" interfacename="saturationlow" />
<input name="outhigh" type="float" interfacename="saturationhigh" />
</range>
<range name="N_range_brightness" type="float">
<input name="in" type="float" nodename="N_rand_brightness" />
<input name="outlow" type="float" interfacename="brightnesslow" />
<input name="outhigh" type="float" interfacename="brightnesshigh" />
</range>
<combine3 name="N_combine_HSV" type="color3">
<input name="in1" type="float" nodename="N_range_hue" />
<input name="in2" type="float" nodename="N_range_saturation" />
<input name="in3" type="float" nodename="N_range_brightness" />
</combine3>
<hsvtorgb name="N_HSV_to_RGB" type="color3">
<input name="in" type="color3" nodename="N_combine_HSV" />
</hsvtorgb>
<output name="out" type="color3" nodename="N_HSV_to_RGB" />
</nodegraph>
<nodegraph name="NG_randomcolor_integer" nodedef="ND_randomcolor_integer">
<convert name="N_convert1" type="float">
<input name="in" type="integer" interfacename="in" />
</convert>
<randomcolor name="N_randomcolor1" type="color3">
<input name="in" type="float" nodename="N_convert1" />
<input name="huelow" type="float" interfacename="huelow" />
<input name="huehigh" type="float" interfacename="huehigh" />
<input name="saturationlow" type="float" interfacename="saturationlow" />
<input name="saturationhigh" type="float" interfacename="saturationhigh" />
<input name="brightnesslow" type="float" interfacename="brightnesslow" />
<input name="brightnesshigh" type="float" interfacename="brightnesshigh" />
<input name="seed" type="integer" interfacename="seed" />
</randomcolor>
<output name="out" type="color3" nodename="N_randomcolor1" />
</nodegraph>

<!--
<checkerboard>
A 2D checkerboard pattern.
Expand Down