Skip to content

Commit

Permalink
Patterns for circles/hexagons/cloverleafs/grecian/squares refinement
Browse files Browse the repository at this point in the history
Added comments
Removed unnecessary nodedefs/xpos/ypos tags
Nodes moved to Procedurals section
  • Loading branch information
zicher3d committed Jul 14, 2023
1 parent c3e0bc8 commit dd05e9d
Show file tree
Hide file tree
Showing 2 changed files with 2,328 additions and 2,263 deletions.
194 changes: 114 additions & 80 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,120 @@
<output name="out" type="color3" />
</nodedef>

<!--
Node: <circle>
Returns 1 (float) if sample is inside a circle defined by center and radius. Otherwise returns 0
-->
<nodedef name="ND_circle_float" node="circle" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<!--
Node: <cloverleaf>
Returns 1 (float) if sample is inside a cloverleaf shape inscribed by a circle defined by center and radius. Otherwise returns 0
-->
<nodedef name="ND_cloverleaf_float" node="cloverleaf" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<!--
Node: <hexagon>
Returns 1 (float) if sample is inside a hexagon shape inscribed by a circle defined by center and radius. Otherwise returns 0
Uses formulas from Inigo Quilez SDF samples (iquilezles.org)
-->
<nodedef name="ND_hexagon_float" node="hexagon" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<!--
Node: <line>
Returns 1 (float) if sample is at less than radius distance from a line segment defined by point1 and point2. Otherwise returns 0
Segment ends will be rounded.
Uses formulas from Inigo Quilez SDF samples (iquilezles.org)
-->
<nodedef name="ND_line_float" node="line" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.1" uivisible="true" />
<input name="point1" type="vector2" value="0.25, 0.25" uivisible="true" />
<input name="point2" type="vector2" value="0.75, 0.75" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<!--
Node: <circles>
Creates a black and white pattern of circles with a defined spacing and size (diameter).
Pattern can be regular or staggered.
-->
<nodedef name="ND_circles_color3" node="circles" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <cloverleafs>
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_cloverleafs_color3" node="cloverleafs" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <hexagons>
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_hexagons_color3" node="hexagons" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!--
Node: <squares>
Creates a black and white pattern of squares with a defined spacing and size (edge).
Pattern can be regular or staggered.
-->
<nodedef name="ND_squares_color3" node="squares" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<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" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="thickness" type="float" value="0.05" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!-- ======================================================================== -->
<!-- Geometric nodes -->
<!-- ======================================================================== -->
Expand Down Expand Up @@ -4444,84 +4558,4 @@
<output name="out" type="lightshader" defaultinput="in" />
</nodedef>




<nodedef name="ND_circle_float" node="circle" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<nodedef name="ND_cloverleaf_float" node="cloverleaf" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<nodedef name="ND_hexagon_float" node="hexagon" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.5" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<nodedef name="ND_line_float" node="line" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="sample" type="vector2" value="0, 0" uivisible="true" />
<input name="center" type="vector2" value="0, 0" uivisible="true" />
<input name="radius" type="float" value="0.1" uivisible="true" />
<input name="point1" type="vector2" value="0.25, 0.25" uivisible="true" />
<input name="point2" type="vector2" value="0.75, 0.75" uivisible="true" />
<output name="out" type="float" />
</nodedef>

<!-- <Circles Pattern> -->
<nodedef name="ND_circles_color3" node="circles" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!-- <Cloverleaf Pattern> -->
<nodedef name="ND_cloverleafs_color3" node="cloverleafs" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!-- <Hexagons Pattern> -->
<nodedef name="ND_hexagons_color3" node="hexagons" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!-- <Squares Pattern> -->
<nodedef name="ND_squares_color3" node="squares" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="size" type="float" value="0.5" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>

<!-- <Grecian Pattern (Thickness)> -->
<nodedef name="ND_grecian_color3" node="grecian" version="0.1" isdefaultversion="true" nodegroup="procedural2d">
<input name="texcoord" type="vector2" value="0, 0" uivisible="true" />
<input name="thickness" type="float" value="0.05" uivisible="true" />
<input name="spacing" type="float" value="1" uivisible="true" />
<input name="staggered" type="boolean" value="false" uivisible="true" />
<output name="out" type="color3" />
</nodedef>



</materialx>
Loading

0 comments on commit dd05e9d

Please sign in to comment.