diff --git a/addons/material_maker/nodes/sdboolean.mmg b/addons/material_maker/nodes/sdboolean.mmg index de9e0d993..cf797c268 100644 --- a/addons/material_maker/nodes/sdboolean.mmg +++ b/addons/material_maker/nodes/sdboolean.mmg @@ -1,51 +1,58 @@ { + "generic_size": 1, "name": "sdboolean", "node_position": { "x": 0, "y": 0 }, "parameters": { - "op": 0 + "op1": 0 }, "seed_int": 0, "shader_model": { - "code": "", + "code": [ + "float $(name_uv)_b = $b($uv);", + "", + "#for", + "$(name_uv)_b = $op# $s#($uv), $(name_uv)_b);", + "#end" + ], "global": "", "inputs": [ { "default": "0.0", "label": "", "longdesc": "The first shape, defined as a signed distance function", - "name": "in1", - "shortdesc": "Input1", + "name": "b", + "shortdesc": "Base Shape", "type": "sdf2d" }, { "default": "0.0", "label": "", - "longdesc": "The second shape, defined as a signed distance function", - "name": "in2", - "shortdesc": "Input2", + "longdesc": "The subsequent shape, defined as a signed distance function", + "name": "s#", + "shortdesc": "Shape#", "type": "sdf2d" } ], "instance": "", - "longdesc": "Performs a boolean operation (union, intersection or difference) between two shapes", + "longdesc": "Performs boolean operation(s) (union, intersection or difference) between two or more shapes", "name": "sdBoolean", "outputs": [ { - "longdesc": "The shape generated by the boolean operation", - "sdf2d": "$op $in1($uv), $in2($uv))", + "longdesc": "The shape generated by the boolean operation(s)", + "sdf2d": "$(name_uv)_b", "shortdesc": "Output", "type": "sdf2d" } ], "parameters": [ { - "default": 2, - "label": "", + "default": 0, + "label": "2:", "longdesc": "The operation performed by this node", - "name": "op", + "name": "op#", "shortdesc": "Operation", "type": "enum", "values": [ diff --git a/addons/material_maker/nodes/sdsmoothboolean.mmg b/addons/material_maker/nodes/sdsmoothboolean.mmg index 7b7fb0cff..4275addb0 100644 --- a/addons/material_maker/nodes/sdsmoothboolean.mmg +++ b/addons/material_maker/nodes/sdsmoothboolean.mmg @@ -1,16 +1,23 @@ { + "generic_size": 1, "name": "sdsmoothboolean", "node_position": { "x": 0, "y": 0 }, "parameters": { - "k": 0.15, - "op": 0 + "k1": 0, + "op1": 0 }, "seed_int": 0, "shader_model": { - "code": "", + "code": [ + "float $(name_uv)_b = $b($uv);", + "", + "#for", + "$(name_uv)_b = sdSmooth$op#($s#($uv), $(name_uv)_b, $k#);", + "#end" + ], "global": [ "float sdSmoothUnion( float d1, float d2, float k ) {", "\tfloat h = clamp( 0.5 + 0.5*(d2-d1)/k, 0.0, 1.0 );", @@ -30,26 +37,26 @@ "default": "0.0", "label": "", "longdesc": "The first shape, defined as a signed distance function", - "name": "in1", - "shortdesc": "Input1", + "name": "b", + "shortdesc": "Base Shape", "type": "sdf2d" }, { "default": "0.0", "label": "", - "longdesc": "The second shape, defined as a signed distance function", - "name": "in2", - "shortdesc": "Input2", + "longdesc": "The subsequent shape, defined as a signed distance function", + "name": "s#", + "shortdesc": "Shape#", "type": "sdf2d" } ], "instance": "", - "longdesc": "Performs a smooth boolean operation (union, intersection or difference) between two shapes", + "longdesc": "Performs smooth boolean operations (union, intersection or difference) between two or more shapes", "name": "sdSmoothBoolean", "outputs": [ { - "longdesc": "The shape generated by the boolean operation", - "sdf2d": "sdSmooth$op($in1($uv), $in2($uv), $k)", + "longdesc": "The shape generated by the boolean operation(s)", + "sdf2d": "$(name_uv)_b", "shortdesc": "Output", "type": "sdf2d" } @@ -57,10 +64,10 @@ "parameters": [ { "default": 0, - "label": "", + "label": "2:", "longdesc": "The operation performed by this node", - "name": "op", - "shortdesc": "Operation", + "name": "op#", + "shortdesc": "Operation#", "type": "enum", "values": [ { @@ -80,12 +87,12 @@ { "control": "None", "default": 0, - "label": "", + "label": "2:", "longdesc": "The smoothness of the boolean operation", "max": 1, "min": 0, - "name": "k", - "shortdesc": "Smoothness", + "name": "k#", + "shortdesc": "Smoothness#", "step": 0.01, "type": "float" } diff --git a/material_maker/doc/images/node_simple_sdf_operators_sdboolean.png b/material_maker/doc/images/node_simple_sdf_operators_sdboolean.png index 107447844..6ee8ff350 100644 Binary files a/material_maker/doc/images/node_simple_sdf_operators_sdboolean.png and b/material_maker/doc/images/node_simple_sdf_operators_sdboolean.png differ diff --git a/material_maker/doc/images/node_simple_sdf_operators_sdsmoothboolean.png b/material_maker/doc/images/node_simple_sdf_operators_sdsmoothboolean.png index bedb9386f..941e10a5c 100644 Binary files a/material_maker/doc/images/node_simple_sdf_operators_sdsmoothboolean.png and b/material_maker/doc/images/node_simple_sdf_operators_sdsmoothboolean.png differ diff --git a/material_maker/doc/node_simple_sdf_operators_sdboolean.rst b/material_maker/doc/node_simple_sdf_operators_sdboolean.rst index 668023058..a2eabf866 100644 --- a/material_maker/doc/node_simple_sdf_operators_sdboolean.rst +++ b/material_maker/doc/node_simple_sdf_operators_sdboolean.rst @@ -10,7 +10,9 @@ intersection or difference) of its inputs. Inputs :::::: -The **sdBoolean** node accepts 2 inputs in signed distance function format. +The **sdBoolean** node accepts two or more inputs in signed distance function format. + +This node is variadic, and more shapes can be added. Outputs ::::::: diff --git a/material_maker/doc/node_simple_sdf_operators_sdsmoothboolean.rst b/material_maker/doc/node_simple_sdf_operators_sdsmoothboolean.rst index 692302e84..74da8ad50 100644 --- a/material_maker/doc/node_simple_sdf_operators_sdsmoothboolean.rst +++ b/material_maker/doc/node_simple_sdf_operators_sdsmoothboolean.rst @@ -10,7 +10,9 @@ intersection or difference) of its inputs. Inputs :::::: -The **sdSmoothBoolean** node accepts 2 inputs in signed distance function format. +The **sdSmoothBoolean** node accepts two or more inputs in signed distance function format. + +This node is variadic, and more shapes can be added. Outputs :::::::