Skip to content

Commit

Permalink
Split grecian into grid and crosshatch
Browse files Browse the repository at this point in the history
This changelist splits the 'grecian' node into its component parts, 'grid' and 'crosshatch', allowing artists to build a wider set of combinations of these two primitives.
  • Loading branch information
jstone-lucasfilm committed Aug 15, 2023
1 parent e101bae commit b5e216c
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 140 deletions.
40 changes: 20 additions & 20 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1139,55 +1139,53 @@
</nodedef>

<!--
Node: <tiledcircles>
Creates a black and white pattern of circles with a defined spacing and size (diameter).
Node: <grid>
Creates a grid pattern with the given tiling, offset, and line thickness.
Pattern can be regular or staggered.
-->
<nodedef name="ND_tiledcircles_color3" node="tiledcircles" nodegroup="procedural2d">
<nodedef name="ND_grid_color3" node="grid" 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="size" type="float" value="0.5" />
<input name="thickness" type="float" value="0.05" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <tiledcloverleafs>
Creates a black and white pattern of cloverleafs with a defined spacing and size (diameter of the circles circumscribing the shape).
Node: <crosshatch>
Creates a crosshatch pattern with the given tiling, offset, and line thickness.
Pattern can be regular or staggered.
-->
<nodedef name="ND_tiledcloverleafs_color3" node="tiledcloverleafs" nodegroup="procedural2d">
<nodedef name="ND_crosshatch_color3" node="crosshatch" 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="size" type="float" value="0.5" />
<input name="spacing" type="float" value="1" />
<input name="thickness" type="float" value="0.05" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <tiledhexagons>
Creates a black and white pattern of hexagons with a defined spacing and size (diameter of the circles circumscribing the shape).
Node: <tiledcircles>
Creates a black and white pattern of circles with a defined spacing and size (diameter).
Pattern can be regular or staggered.
-->
<nodedef name="ND_tiledhexagons_color3" node="tiledhexagons" nodegroup="procedural2d">
<nodedef name="ND_tiledcircles_color3" node="tiledcircles" 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="size" type="float" value="0.5" />
<input name="spacing" type="float" value="1" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <tiledsquares>
Creates a black and white pattern of squares with a defined spacing and size (edge).
Node: <tiledcloverleafs>
Creates a black and white pattern of cloverleafs with a defined spacing and size (diameter of the circles circumscribing the shape).
Pattern can be regular or staggered.
-->
<nodedef name="ND_tiledsquares_color3" node="tiledsquares" nodegroup="procedural2d">
<nodedef name="ND_tiledcloverleafs_color3" node="tiledcloverleafs" 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" />
Expand All @@ -1198,19 +1196,21 @@
</nodedef>

<!--
Node: <grecian>
Creates a black and white grecian pattern with a defined spacing and lines thickness.
Node: <tiledhexagons>
Creates a black and white pattern of hexagons with a defined spacing and size (diameter of the circles circumscribing the shape).
Pattern can be regular or staggered.
-->
<nodedef name="ND_grecian_color3" node="grecian" nodegroup="procedural2d">
<nodedef name="ND_tiledhexagons_color3" node="tiledhexagons" 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="size" type="float" value="0.5" />
<input name="spacing" type="float" value="1" />
<input name="staggered" type="boolean" value="false" />
<output name="out" type="color3" />
</nodedef>


<!-- ======================================================================== -->
<!-- Geometric nodes -->
<!-- ======================================================================== -->
Expand Down
89 changes: 39 additions & 50 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2011,11 +2011,11 @@
</nodegraph>

<!--
Node: <tiledsquares>
Creates a black and white pattern of squares with a defined spacing and size (edge).
Node: <grid>
Creates a grid pattern with the given tiling, offset, and line thickness.
Pattern can be regular or staggered.
-->
<nodegraph name="NG_tiledsquares_color3" nodedef="ND_tiledsquares_color3">
<nodegraph name="NG_grid_color3" nodedef="ND_grid_color3">
<multiply name="texcoord_scale" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="uvtiling" />
Expand All @@ -2024,10 +2024,21 @@
<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" />
Expand All @@ -2046,52 +2057,56 @@
<modulo name="mod_X" type="float">
<input name="in1" type="float" nodename="stagger_selection" />
</modulo>
<modulo name="mod_Y" type="float">
<input name="in1" type="float" nodename="texcoord_bias" channels="y" />
</modulo>
<combine2 name="texcoord_mod" type="vector2">
<multiply name="modx_2" type="float">
<input name="in1" type="float" nodename="mod_X" />
<input name="in2" type="float" nodename="mod_Y" />
</combine2>
<multiply name="tecoord_mod_2" type="vector2">
<input name="in1" type="vector2" nodename="texcoord_mod" />
<input name="in2" type="float" value="2" />
</multiply>
<subtract name="tecoord_sub_1" type="vector2">
<input name="in1" type="vector2" nodename="tecoord_mod_2" />
<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="tecoord_abs" type="vector2">
<input name="in" type="vector2" nodename="tecoord_sub_1" />
<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="tecoord_abs" channels="x" />
<input name="value2" type="float" interfacename="size" />
<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="tecoord_abs" channels="y" />
<input name="value2" type="float" interfacename="size" />
<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>
<convert name="to_rgb" type="color3">
<input name="in" type="float" nodename="min" />
<input name="in" type="float" nodename="inv_result" />
</convert>
<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.
Node: <crosshatch>
Creates a crosshatch pattern with the given tiling, offset, and line thickness.
Pattern can be regular or staggered.
-->
<nodegraph name="NG_grecian_color3" nodedef="ND_grecian_color3">
<nodegraph name="NG_crosshatch_color3" nodedef="ND_crosshatch_color3">
<multiply name="texcoord_scale" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="uvtiling" />
Expand Down Expand Up @@ -2145,32 +2160,6 @@
<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" />
Expand All @@ -2192,7 +2181,7 @@
<input name="in2" type="float" nodename="line_diag2" />
</max>
<max name="max" type="float">
<input name="in1" type="float" nodename="inv_result" />
<input name="in1" type="float" nodename="composite_diags" />
<input name="in2" type="float" nodename="composite_diags" />
</max>
<convert name="to_rgb" type="color3">
Expand Down
14 changes: 0 additions & 14 deletions resources/Materials/TestSuite/stdlib/procedural/grecian.mtlx

This file was deleted.

22 changes: 22 additions & 0 deletions resources/Materials/TestSuite/stdlib/procedural/linepatterns.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
<grid name="grid_color3" type="color3">
<input name="uvtiling" type="vector2" value="58, 58" />
<input name="thickness" type="float" value="0.1" />
</grid>
<crosshatch name="crosshatch_color3" type="color3">
<input name="uvtiling" type="vector2" value="29, 29" />
<input name="thickness" type="float" value="0.05" />
</crosshatch>
<max name="union_color3" type="color3">
<input name="in1" type="color3" nodename="grid_color3" />
<input name="in2" type="color3" nodename="crosshatch_color3" />
</max>
<standard_surface name="SR_test_union" type="surfaceshader">
<input name="base" type="float" value="1" />
<input name="base_color" type="color3" nodename="union_color3" />
</standard_surface>
<surfacematerial name="test_union" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_test_union" />
</surfacematerial>
</materialx>
14 changes: 0 additions & 14 deletions resources/Materials/TestSuite/stdlib/procedural/tiledcircles.mtlx

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions resources/Materials/TestSuite/stdlib/procedural/tiledhexagons.mtlx

This file was deleted.

38 changes: 38 additions & 0 deletions resources/Materials/TestSuite/stdlib/procedural/tiledshapes.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
<tiledcircles name="tiledcircles_color3" type="color3">
<input name="uvtiling" type="vector2" value="29, 29" />
<input name="size" type="float" value="0.8" />
</tiledcircles>
<standard_surface name="SR_test_tiledcircles" type="surfaceshader">
<input name="base" type="float" value="1" />
<input name="base_color" type="color3" nodename="tiledcircles_color3" />
</standard_surface>
<surfacematerial name="test_tiledcircles" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_test_tiledcircles" />
</surfacematerial>

<tiledcloverleafs name="tiledcloverleafs_color3" type="color3">
<input name="uvtiling" type="vector2" value="29, 29" />
<input name="size" type="float" value="0.8" />
</tiledcloverleafs>
<standard_surface name="SR_test_tiledcloverleafs" type="surfaceshader">
<input name="base" type="float" value="1" />
<input name="base_color" type="color3" nodename="tiledcloverleafs_color3" />
</standard_surface>
<surfacematerial name="test_tiledcloverleafs" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_test_tiledcloverleafs" />
</surfacematerial>

<tiledhexagons name="tiledhexagons_color3" type="color3">
<input name="uvtiling" type="vector2" value="29, 29" />
<input name="size" type="float" value="0.7" />
</tiledhexagons>
<standard_surface name="SR_test_tiledhexagons" type="surfaceshader">
<input name="base" type="float" value="1" />
<input name="base_color" type="color3" nodename="tiledhexagons_color3" />
</standard_surface>
<surfacematerial name="test_tiledhexagons" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_test_tiledhexagons" />
</surfacematerial>
</materialx>
14 changes: 0 additions & 14 deletions resources/Materials/TestSuite/stdlib/procedural/tiledsquares.mtlx

This file was deleted.

0 comments on commit b5e216c

Please sign in to comment.