Skip to content

Commit

Permalink
Define line patterns after tiled shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm committed Aug 4, 2023
1 parent c98e5a7 commit c782e03
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 129 deletions.
28 changes: 14 additions & 14 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1138,20 +1138,6 @@
<output name="out" type="float" />
</nodedef>

<!--
Node: <grecian>
Creates a black and white grecian pattern with a defined spacing and lines thickness.
Pattern can be regular or staggered.
-->
<nodedef name="ND_grecian_color3" node="grecian" nodegroup="procedural2d">
<input name="texcoord" type="vector2" defaultgeomprop="UV0" />
<input name="uvtiling" type="vector2" value="1.0, 1.0" />
<input name="uvoffset" type="vector2" value="0.0, 0.0" />
<input name="thickness" type="float" value="0.05" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <tiledcircles>
Creates a black and white pattern of circles with a defined spacing and size (diameter).
Expand Down Expand Up @@ -1211,6 +1197,20 @@
<output name="out" type="color3" />
</nodedef>

<!--
Node: <grecian>
Creates a black and white grecian pattern with a defined spacing and lines thickness.
Pattern can be regular or staggered.
-->
<nodedef name="ND_grecian_color3" node="grecian" nodegroup="procedural2d">
<input name="texcoord" type="vector2" defaultgeomprop="UV0" />
<input name="uvtiling" type="vector2" value="1.0, 1.0" />
<input name="uvoffset" type="vector2" value="0.0, 0.0" />
<input name="thickness" type="float" value="0.05" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>

<!-- ======================================================================== -->
<!-- Geometric nodes -->
<!-- ======================================================================== -->
Expand Down
230 changes: 115 additions & 115 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1683,121 +1683,6 @@
<output name="out" type="float" nodename="dist_comp" />
</nodegraph>

<!--
Node: <grecian>
Creates a black and white grecian pattern with a defined spacing and lines thickness.
Pattern can be regular or staggered.
-->
<nodegraph name="NG_grecian_color3" nodedef="ND_grecian_color3">
<multiply name="texcoord_scale" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="uvtiling" />
</multiply>
<subtract name="texcoord_bias" type="vector2">
<input name="in1" type="vector2" nodename="texcoord_scale" />
<input name="in2" type="vector2" interfacename="uvoffset" />
</subtract>
<subtract name="thick_to_size" type="float">
<input name="in1" type="float" value="1.0" />
<input name="in2" type="float" interfacename="thickness" />
</subtract>
<modulo name="mod_Y" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="y" />
</modulo>
<modulo name="mod_Y_row" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="y" />
<input name="in2" type="float" value="2" />
</modulo>
<multiply name="mody_2" type="float">
<input name="in1" type="float" nodename="mod_Y" />
<input name="in2" type="float" value="2" />
</multiply>
<ifgreater name="alt_rows_shift" type="float">
<input name="value1" type="float" nodename="mod_Y_row" />
<input name="value2" type="float" value="1" />
<input name="in1" type="float" value="0.5" />
</ifgreater>
<add name="shift_X" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="x" />
<input name="in2" type="float" nodename="alt_rows_shift" />
</add>
<ifequal name="stagger_selection" type="float">
<input name="value1" type="boolean" interfacename="staggered" />
<input name="value2" type="boolean" value="true" />
<input name="in1" type="float" nodename="shift_X" />
<input name="in2" type="float" nodename="texcoord_bias" channels="x" />
</ifequal>
<modulo name="mod_X" type="float">
<input name="in1" type="float" nodename="stagger_selection" />
</modulo>
<multiply name="modx_2" type="float">
<input name="in1" type="float" nodename="mod_X" />
<input name="in2" type="float" value="2" />
</multiply>
<subtract name="subX_1" type="float">
<input name="in1" type="float" nodename="modx_2" />
<input name="in2" type="float" value="1" />
</subtract>
<subtract name="subY_1" type="float">
<input name="in1" type="float" nodename="mody_2" />
<input name="in2" type="float" value="1" />
</subtract>
<absval name="abs_X" type="float">
<input name="in" type="float" nodename="subX_1" />
</absval>
<absval name="abs_Y" type="float">
<input name="in" type="float" nodename="subY_1" />
</absval>
<ifgreater name="X_detect" type="float">
<input name="value1" type="float" nodename="abs_X" />
<input name="value2" type="float" nodename="thick_to_size" />
<input name="in1" type="float" value="0" />
<input name="in2" type="float" value="1" />
</ifgreater>
<ifgreater name="Y_detect" type="float">
<input name="value1" type="float" nodename="abs_Y" />
<input name="value2" type="float" nodename="thick_to_size" />
<input name="in1" type="float" value="0" />
<input name="in2" type="float" value="1" />
</ifgreater>
<min name="min" type="float">
<input name="in1" type="float" nodename="X_detect" />
<input name="in2" type="float" nodename="Y_detect" />
</min>
<subtract name="inv_result" type="float">
<input name="in1" type="float" value="1" />
<input name="in2" type="float" nodename="min" />
</subtract>
<combine2 name="sample_vec" type="vector2">
<input name="in1" type="float" nodename="subX_1" />
<input name="in2" type="float" nodename="subY_1" />
</combine2>
<line name="line_diag1" type="float">
<input name="sample" type="vector2" nodename="sample_vec" />
<input name="radius" type="float" interfacename="thickness" />
<input name="point1" type="vector2" value="1, 1" />
<input name="point2" type="vector2" value="-1, -1" />
</line>
<line name="line_diag2" type="float">
<input name="sample" type="vector2" nodename="sample_vec" />
<input name="radius" type="float" interfacename="thickness" />
<input name="point1" type="vector2" value="-1, 1" />
<input name="point2" type="vector2" value="1, -1" />
</line>
<max name="composite_diags" type="float">
<input name="in1" type="float" nodename="line_diag1" />
<input name="in2" type="float" nodename="line_diag2" />
</max>
<max name="max" type="float">
<input name="in1" type="float" nodename="inv_result" />
<input name="in2" type="float" nodename="composite_diags" />
</max>
<convert name="to_rgb" type="color3">
<input name="in" type="float" nodename="max" />
</convert>
<output name="out" type="color3" nodename="to_rgb" />
</nodegraph>

<!--
Node: <tiledcircles>
Creates a black and white pattern of circles with a defined spacing and size (diameter).
Expand Down Expand Up @@ -2265,6 +2150,121 @@
<output name="out" type="color3" nodename="to_rgb" />
</nodegraph>

<!--
Node: <grecian>
Creates a black and white grecian pattern with a defined spacing and lines thickness.
Pattern can be regular or staggered.
-->
<nodegraph name="NG_grecian_color3" nodedef="ND_grecian_color3">
<multiply name="texcoord_scale" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="uvtiling" />
</multiply>
<subtract name="texcoord_bias" type="vector2">
<input name="in1" type="vector2" nodename="texcoord_scale" />
<input name="in2" type="vector2" interfacename="uvoffset" />
</subtract>
<subtract name="thick_to_size" type="float">
<input name="in1" type="float" value="1.0" />
<input name="in2" type="float" interfacename="thickness" />
</subtract>
<modulo name="mod_Y" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="y" />
</modulo>
<modulo name="mod_Y_row" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="y" />
<input name="in2" type="float" value="2" />
</modulo>
<multiply name="mody_2" type="float">
<input name="in1" type="float" nodename="mod_Y" />
<input name="in2" type="float" value="2" />
</multiply>
<ifgreater name="alt_rows_shift" type="float">
<input name="value1" type="float" nodename="mod_Y_row" />
<input name="value2" type="float" value="1" />
<input name="in1" type="float" value="0.5" />
</ifgreater>
<add name="shift_X" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="x" />
<input name="in2" type="float" nodename="alt_rows_shift" />
</add>
<ifequal name="stagger_selection" type="float">
<input name="value1" type="boolean" interfacename="staggered" />
<input name="value2" type="boolean" value="true" />
<input name="in1" type="float" nodename="shift_X" />
<input name="in2" type="float" nodename="texcoord_bias" channels="x" />
</ifequal>
<modulo name="mod_X" type="float">
<input name="in1" type="float" nodename="stagger_selection" />
</modulo>
<multiply name="modx_2" type="float">
<input name="in1" type="float" nodename="mod_X" />
<input name="in2" type="float" value="2" />
</multiply>
<subtract name="subX_1" type="float">
<input name="in1" type="float" nodename="modx_2" />
<input name="in2" type="float" value="1" />
</subtract>
<subtract name="subY_1" type="float">
<input name="in1" type="float" nodename="mody_2" />
<input name="in2" type="float" value="1" />
</subtract>
<absval name="abs_X" type="float">
<input name="in" type="float" nodename="subX_1" />
</absval>
<absval name="abs_Y" type="float">
<input name="in" type="float" nodename="subY_1" />
</absval>
<ifgreater name="X_detect" type="float">
<input name="value1" type="float" nodename="abs_X" />
<input name="value2" type="float" nodename="thick_to_size" />
<input name="in1" type="float" value="0" />
<input name="in2" type="float" value="1" />
</ifgreater>
<ifgreater name="Y_detect" type="float">
<input name="value1" type="float" nodename="abs_Y" />
<input name="value2" type="float" nodename="thick_to_size" />
<input name="in1" type="float" value="0" />
<input name="in2" type="float" value="1" />
</ifgreater>
<min name="min" type="float">
<input name="in1" type="float" nodename="X_detect" />
<input name="in2" type="float" nodename="Y_detect" />
</min>
<subtract name="inv_result" type="float">
<input name="in1" type="float" value="1" />
<input name="in2" type="float" nodename="min" />
</subtract>
<combine2 name="sample_vec" type="vector2">
<input name="in1" type="float" nodename="subX_1" />
<input name="in2" type="float" nodename="subY_1" />
</combine2>
<line name="line_diag1" type="float">
<input name="sample" type="vector2" nodename="sample_vec" />
<input name="radius" type="float" interfacename="thickness" />
<input name="point1" type="vector2" value="1, 1" />
<input name="point2" type="vector2" value="-1, -1" />
</line>
<line name="line_diag2" type="float">
<input name="sample" type="vector2" nodename="sample_vec" />
<input name="radius" type="float" interfacename="thickness" />
<input name="point1" type="vector2" value="-1, 1" />
<input name="point2" type="vector2" value="1, -1" />
</line>
<max name="composite_diags" type="float">
<input name="in1" type="float" nodename="line_diag1" />
<input name="in2" type="float" nodename="line_diag2" />
</max>
<max name="max" type="float">
<input name="in1" type="float" nodename="inv_result" />
<input name="in2" type="float" nodename="composite_diags" />
</max>
<convert name="to_rgb" type="color3">
<input name="in" type="float" nodename="max" />
</convert>
<output name="out" type="color3" nodename="to_rgb" />
</nodegraph>

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

0 comments on commit c782e03

Please sign in to comment.