diff --git a/addons/material_maker/nodes/splatter_base.mmg b/addons/material_maker/nodes/splatter_base.mmg deleted file mode 100644 index 3f1e6ce..0000000 --- a/addons/material_maker/nodes/splatter_base.mmg +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "splatter_base", - "node_position": { - "x": 0, - "y": 0 - }, - "parameters": { - "name": 0.5, - "offx": 0, - "offy": 0, - "repeat": 8, - "scale": 1.64, - "size": 1 - }, - "shader_model": { - "code": "vec4 $(name_uv)_xyzw = splatter($uv, $repeat, $scale, vec2($offx, $offy));", - "global": "vec4 splatter(vec2 uv, float repeat, float scale, vec2 offset) {\n\tvec2 center = (floor(uv*repeat-offset)+0.5+offset)/repeat;\n\tvec2 tmp = (uv-center)*repeat*2.0;\n\tvec2 src_uv;\n\tsrc_uv.x = tmp.x*cos(center.x)+tmp.y*sin(center.x);\n\tsrc_uv.y = tmp.x*sin(center.x)-tmp.y*cos(center.x);\n\tsrc_uv /= scale;\n\tsrc_uv += 0.5;\n\treturn vec4(src_uv, center);\n}", - "inputs": [ - { - "default": "0.0", - "label": "", - "name": "in", - "type": "f" - }, - { - "default": "1.0", - "label": "", - "name": "mask", - "type": "f" - } - ], - "instance": "", - "name": "Splatter", - "outputs": [ - { - "f": "$in($(name_uv)_xyzw.xy)*$mask($(name_uv)_xyzw.zw)", - "type": "f" - } - ], - "parameters": [ - { - "default": 4, - "label": "Repeat", - "max": 128, - "min": 2, - "name": "repeat", - "step": 1, - "type": "float" - }, - { - "default": 1, - "label": "Scale", - "max": 2, - "min": 0, - "name": "scale", - "step": 0.01, - "type": "float" - }, - { - "default": 0.5, - "label": "Offset X", - "max": 1, - "min": 0, - "name": "offx", - "step": 0.1, - "type": "float" - }, - { - "default": 0.5, - "label": "Offset Y", - "max": 1, - "min": 0, - "name": "offy", - "step": 0.1, - "type": "float" - } - ] - }, - "type": "shader" -} \ No newline at end of file diff --git a/material_maker/doc/images/node_transform_tiler.png b/material_maker/doc/images/node_transform_tiler.png new file mode 100644 index 0000000..3d0d7bd Binary files /dev/null and b/material_maker/doc/images/node_transform_tiler.png differ diff --git a/material_maker/doc/images/node_transform_tiler_color.png b/material_maker/doc/images/node_transform_tiler_color.png new file mode 100644 index 0000000..f6a104b Binary files /dev/null and b/material_maker/doc/images/node_transform_tiler_color.png differ diff --git a/material_maker/doc/images/node_transform_tiler_samples.png b/material_maker/doc/images/node_transform_tiler_samples.png new file mode 100644 index 0000000..009995c Binary files /dev/null and b/material_maker/doc/images/node_transform_tiler_samples.png differ diff --git a/material_maker/doc/node_transform_splatter.rst b/material_maker/doc/node_transform_splatter.rst index 5fd449e..d57e0e0 100644 --- a/material_maker/doc/node_transform_splatter.rst +++ b/material_maker/doc/node_transform_splatter.rst @@ -2,7 +2,7 @@ Splatter node ~~~~~~~~~~~~~ The **Splatter** node splats several instances of its input with optional scale and rotation variations. -instances are mixed with each other using a *lighten* filter. +Overlapping instances are mixed with each other using a *lighten* filter. The **Splatter** also has a color version whose input is in RGBA format. @@ -26,7 +26,7 @@ The **Splatter** node outputs the splat image. Parameters ++++++++++ -The **Splatter** node has two parameters: +The **Splatter** node accepts the following parameters: * *Count*, the number of instances of the source image in the result, including those canceled by the mask. * *Inputs* is the number of alternate shapes in the input (1, 4 or 16). Images containing several diff --git a/material_maker/doc/node_transform_tiler.rst b/material_maker/doc/node_transform_tiler.rst new file mode 100644 index 0000000..4af8cc0 --- /dev/null +++ b/material_maker/doc/node_transform_tiler.rst @@ -0,0 +1,42 @@ +Tiler node +~~~~~~~~~~ + +The **Tiler** node tiles several instances of its input with optional scale and rotation variations. +Overlapping instances are mixed with each other using a *lighten* filter. + +The **Tiler** also has a color version whose input is in RGBA format. + +.. image:: images/node_transform_tiler.png + :align: center + +Inputs +++++++ + +The **Tiler** node accepts two inputs: + +* The *Source* inputs is the image to be splat into the output. + +* The *Mask* input is a greyscale image that is used as a mask and affects each instance's value. + +Outputs ++++++++ + +The **Tiler** node outputs the splat image. + +Parameters +++++++++++ + +The **Tiler** node accepts the following parameters: + +* *Tile X* and *Tile Y*, the number of columns and rows of of the tile pattern. +* *Inputs* is the number of alternate shapes in the input (1, 4 or 16). Images containing several + shapes can easily be created using the **Tile2x2** node. +* *Offset* is the maximum random offset applied to each instance (relative to tiles size). +* *Rotate* is the maximum angle of the random rotation applied to each instance. +* *Scale* is the amount of scaling applied to each instance. + +Example images +++++++++++++++ + +.. image:: images/node_transform_tiler_samples.png + :align: center diff --git a/material_maker/doc/nodes_transform.rst b/material_maker/doc/nodes_transform.rst index 5fb522b..2ed87d3 100644 --- a/material_maker/doc/nodes_transform.rst +++ b/material_maker/doc/nodes_transform.rst @@ -13,3 +13,4 @@ The transform nodes are nodes that affect the geometry of their input. node_transform_customuv node_transform_tile2x2 node_transform_splatter + node_transform_tiler diff --git a/material_maker/examples/doc_tools.ptex b/material_maker/examples/doc_tools.ptex index 8a4bf4a..7701781 100644 --- a/material_maker/examples/doc_tools.ptex +++ b/material_maker/examples/doc_tools.ptex @@ -151,7 +151,13 @@ "to_port": 0 }, { - "from": "splatter_color", + "from": "tile2x2", + "from_port": 0, + "to": "tiler_color", + "to_port": 0 + }, + { + "from": "tiler_color", "from_port": 0, "to": "Material", "to_port": 0 @@ -2320,7 +2326,7 @@ }, "parameters": { "edge": 1, - "radius": 0.21, + "radius": 0.13, "shape": 0, "sides": 6 }, @@ -2371,7 +2377,7 @@ }, "parameters": { "edge": 1, - "radius": 0.18, + "radius": 0.12, "shape": 1, "sides": 6 }, @@ -2473,7 +2479,7 @@ }, "parameters": { "edge": 1, - "radius": 0.13, + "radius": 0.12, "shape": 3, "sides": 7 }, @@ -2482,8 +2488,8 @@ { "name": "tile2x2", "node_position": { - "x": -522.442566, - "y": 943.082642 + "x": -558.442566, + "y": 890.082642 }, "parameters": { @@ -2503,6 +2509,23 @@ "select_inputs": 0 }, "type": "splatter_color" + }, + { + "name": "tiler_color", + "node_position": { + "x": -598.862, + "y": 599.541748 + }, + "parameters": { + "offset": 0.62, + "overlap": 1, + "rotate": 45, + "scale": 0.2, + "select_inputs": 1, + "tx": 8, + "ty": 8 + }, + "type": "tiler_color" } ], "parameters": { diff --git a/material_maker/examples/splatter.ptex b/material_maker/examples/splatter.ptex index 94a52ae..fba4261 100644 --- a/material_maker/examples/splatter.ptex +++ b/material_maker/examples/splatter.ptex @@ -1,17 +1,5 @@ { "connections": [ - { - "from": "blend", - "from_port": 0, - "to": "blend_2_2", - "to_port": 0 - }, - { - "from": "blend_2_2", - "from_port": 0, - "to": "normal_map", - "to_port": 0 - }, { "from": "normal_map", "from_port": 0, @@ -30,12 +18,6 @@ "to": "blend_3", "to_port": 0 }, - { - "from": "blend_2_2", - "from_port": 0, - "to": "colorize", - "to_port": 0 - }, { "from": "colorize", "from_port": 0, @@ -78,84 +60,6 @@ "to": "blend_4", "to_port": 1 }, - { - "from": "blend_3", - "from_port": 0, - "to": "splatter_base_2", - "to_port": 0 - }, - { - "from": "blend_3", - "from_port": 0, - "to": "splatter_base_2_3", - "to_port": 0 - }, - { - "from": "blend_3", - "from_port": 0, - "to": "splatter_base_2_3_2", - "to_port": 0 - }, - { - "from": "blend_3", - "from_port": 0, - "to": "splatter_base_2_3_2_2", - "to_port": 0 - }, - { - "from": "colorize_2", - "from_port": 0, - "to": "splatter_base_2", - "to_port": 1 - }, - { - "from": "colorize_2", - "from_port": 0, - "to": "splatter_base_2_3", - "to_port": 1 - }, - { - "from": "colorize_2", - "from_port": 0, - "to": "splatter_base_2_3_2", - "to_port": 1 - }, - { - "from": "colorize_2", - "from_port": 0, - "to": "splatter_base_2_3_2_2", - "to_port": 1 - }, - { - "from": "splatter_base_2", - "from_port": 0, - "to": "blend", - "to_port": 0 - }, - { - "from": "splatter_base_2_3_2", - "from_port": 0, - "to": "blend_2", - "to_port": 0 - }, - { - "from": "blend_2", - "from_port": 0, - "to": "blend_2_2", - "to_port": 1 - }, - { - "from": "splatter_base_2_3_2_2", - "from_port": 0, - "to": "blend_2", - "to_port": 1 - }, - { - "from": "splatter_base_2_3", - "from_port": 0, - "to": "blend", - "to_port": 1 - }, { "from": "pattern_2", "from_port": 0, @@ -197,6 +101,42 @@ "from_port": 0, "to": "blend_6", "to_port": 1 + }, + { + "from": "blend_3", + "from_port": 0, + "to": "tiler", + "to_port": 0 + }, + { + "from": "colorize_2", + "from_port": 0, + "to": "tiler", + "to_port": 1 + }, + { + "from": "tiler", + "from_port": 0, + "to": "normal_map", + "to_port": 0 + }, + { + "from": "tiler", + "from_port": 0, + "to": "colorize", + "to_port": 0 + }, + { + "from": "tiler", + "from_port": 0, + "to": "colorize_5", + "to_port": 0 + }, + { + "from": "colorize_5", + "from_port": 0, + "to": "Material", + "to_port": 0 } ], "label": "Graph", @@ -221,7 +161,7 @@ "type": "Color" }, "ao_light_affect": 1, - "depth_scale": 0.2, + "depth_scale": 0.1, "emission_energy": 1, "metallic": 1, "normal_scale": 1, @@ -238,71 +178,13 @@ "y": -404 }, "parameters": { - "param0": 0 + }, "type": "remote", "widgets": [ - { - "label": "Unnamed", - "linked_widgets": [ - { - "node": "splatter_base_2", - "widget": "repeat" - }, - { - "node": "splatter_base_2_3", - "widget": "repeat" - }, - { - "node": "splatter_base_2_3_2", - "widget": "repeat" - }, - { - "node": "splatter_base_2_3_2_2", - "widget": "repeat" - } - ], - "name": "param0", - "type": "linked_control" - } + ] }, - { - "name": "blend", - "node_position": { - "x": -144.109253, - "y": -151 - }, - "parameters": { - "amount": 1, - "blend_type": 9 - }, - "type": "blend" - }, - { - "name": "blend_2", - "node_position": { - "x": -131.166183, - "y": 110 - }, - "parameters": { - "amount": 1, - "blend_type": 9 - }, - "type": "blend" - }, - { - "name": "blend_2_2", - "node_position": { - "x": -133.166168, - "y": -22 - }, - "parameters": { - "amount": 1, - "blend_type": 9 - }, - "type": "blend" - }, { "name": "blend_3", "node_position": { @@ -318,17 +200,14 @@ { "name": "normal_map", "node_position": { - "x": 166.778687, - "y": -64 + "x": 26.778687, + "y": -96 }, "parameters": { - "amount": 0.5, "param0": 12, "param1": 1.02, "param2": 0, - "param3": 0, - "param4": 1, - "size": 4 + "param4": 1 }, "type": "normal_map" }, @@ -340,7 +219,7 @@ }, "parameters": { "edge": 0.051546, - "radius": 0.291661, + "radius": 0.03, "shape": 3, "sides": 5 }, @@ -370,8 +249,8 @@ "label": "Radial Gradient", "name": "graph", "node_position": { - "x": -964.022583, - "y": 29 + "x": -982.022583, + "y": 18 }, "nodes": [ { @@ -410,7 +289,7 @@ "a": 1, "b": 1, "g": 1, - "pos": 1, + "pos": 0.045455, "r": 1 } ], @@ -441,7 +320,7 @@ "a": 1, "b": 1, "g": 1, - "pos": 1, + "pos": 0.045455, "r": 1 } ], @@ -533,7 +412,7 @@ "a": 1, "b": 1, "g": 1, - "pos": 1, + "pos": 0.045455, "r": 1 } ], @@ -545,8 +424,8 @@ { "name": "colorize", "node_position": { - "x": 166.370972, - "y": 37 + "x": 27.370972, + "y": 62 }, "parameters": { "gradient": { @@ -575,8 +454,8 @@ { "name": "perlin", "node_position": { - "x": -715.317078, - "y": 40.266663 + "x": -691.317078, + "y": 36.266663 }, "parameters": { "iterations": 2, @@ -589,8 +468,8 @@ { "name": "colorize_2", "node_position": { - "x": -684.317078, - "y": 180.266663 + "x": -669.317078, + "y": 174.266663 }, "parameters": { "gradient": { @@ -1159,70 +1038,6 @@ }, "type": "blend" }, - { - "name": "splatter_base_2", - "node_position": { - "x": -381.766907, - "y": -265.78183 - }, - "parameters": { - "name": 0.5, - "offx": 0, - "offy": 0, - "repeat": 6, - "scale": 2, - "size": 1 - }, - "type": "splatter_base" - }, - { - "name": "splatter_base_2_3", - "node_position": { - "x": -382.266907, - "y": -132.78183 - }, - "parameters": { - "name": 0.5, - "offx": 0.4, - "offy": 0, - "repeat": 6, - "scale": 2, - "size": 1 - }, - "type": "splatter_base" - }, - { - "name": "splatter_base_2_3_2", - "node_position": { - "x": -379.266907, - "y": 4.21817 - }, - "parameters": { - "name": 0.5, - "offx": 0, - "offy": 0.5, - "repeat": 6, - "scale": 2, - "size": 1 - }, - "type": "splatter_base" - }, - { - "name": "splatter_base_2_3_2_2", - "node_position": { - "x": -376.266907, - "y": 140.21817 - }, - "parameters": { - "name": 0.5, - "offx": 0.5, - "offy": 0.5, - "repeat": 6, - "scale": 2, - "size": 1 - }, - "type": "splatter_base" - }, { "name": "pattern_2", "node_position": { @@ -1533,6 +1348,67 @@ } }, "type": "colorize" + }, + { + "name": "tiler", + "node_position": { + "x": -310.556824, + "y": -53.911621 + }, + "parameters": { + "offset": 0.6, + "overlap": 1, + "rotate": 45, + "scale": 0.2, + "select_inputs": 0, + "tx": 24, + "ty": 24 + }, + "type": "tiler" + }, + { + "name": "colorize_5", + "node_position": { + "x": 22.722137, + "y": -188.911621 + }, + "parameters": { + "gradient": { + "interpolation": 1, + "points": [ + { + "a": 1, + "b": 0.03776, + "g": 0.302083, + "pos": 0.027273, + "r": 0 + }, + { + "a": 1, + "b": 0, + "g": 0.90625, + "pos": 0.054545, + "r": 1 + }, + { + "a": 1, + "b": 0, + "g": 0.90625, + "pos": 0.154545, + "r": 1 + }, + { + "a": 1, + "b": 0.875, + "g": 0, + "pos": 0.227273, + "r": 1 + } + ], + "type": "Gradient" + } + }, + "type": "colorize" } ], "parameters": { diff --git a/material_maker/library/base.json b/material_maker/library/base.json index 7ccac54..a2962cc 100644 --- a/material_maker/library/base.json +++ b/material_maker/library/base.json @@ -2639,6 +2639,38 @@ "tree_item": "Transform/Splatter/Color", "type": "splatter_color" }, + { + "collapsed": true, + "icon": "transform_tiler", + "name": "tiler", + "parameters": { + "offset": 0.25, + "overlap": 2, + "rotate": 45, + "scale": 0.2, + "select_inputs": 0, + "tx": 4, + "ty": 4 + }, + "tree_item": "Transform/Tiler", + "type": "tiler" + }, + { + "collapsed": true, + "icon": "transform_tiler_color", + "name": "tiler_color", + "parameters": { + "offset": 0.25, + "overlap": 1, + "rotate": 45, + "scale": 0.2, + "select_inputs": 0, + "tx": 4, + "ty": 4 + }, + "tree_item": "Transform/Tiler/Color", + "type": "tiler_color" + }, { "collapsed": false, "tree_item": "Workflow" diff --git a/material_maker/library/base/transform_tiler.png b/material_maker/library/base/transform_tiler.png new file mode 100644 index 0000000..1644288 Binary files /dev/null and b/material_maker/library/base/transform_tiler.png differ diff --git a/material_maker/library/base/transform_tiler_color.png b/material_maker/library/base/transform_tiler_color.png new file mode 100644 index 0000000..e79b2b8 Binary files /dev/null and b/material_maker/library/base/transform_tiler_color.png differ