diff --git a/addons/material_maker/nodes/circular_gradient.mmg b/addons/material_maker/nodes/circular_gradient.mmg index 8485e9af8..7346b645a 100644 --- a/addons/material_maker/nodes/circular_gradient.mmg +++ b/addons/material_maker/nodes/circular_gradient.mmg @@ -9,38 +9,36 @@ "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" }, - "repeat": 1 + "mirror": false, + "repeat": 1.0 }, "seed_int": 0, "shader_model": { "code": "", "global": "", - "inputs": [ - - ], + "inputs": [], "instance": "", "name": "Circular Gradient", - "shortdesc": "Circular Gradient", "outputs": [ { "longdesc": "Number of repetitions of the gradient", - "rgba": "$gradient(fract($repeat*0.15915494309*atan($uv.y-0.5, $uv.x-0.5)))", + "rgba": "$gradient($mirror ? 2.0*(0.5-abs(fract($repeat*0.15915494309*atan($uv.y-0.5, $uv.x-0.5))-0.5)) : fract($repeat*0.15915494309*atan($uv.y-0.5, $uv.x-0.5)))", "shortdesc": "Repeat", "type": "rgba" } @@ -48,33 +46,41 @@ "parameters": [ { "control": "None", - "default": 1, + "default": 1.0, "label": "Repeat", "longdesc": "Number of repetitions of the gradient", - "max": 32, - "min": 1, + "max": 32.0, + "min": 1.0, "name": "repeat", "shortdesc": "Repeat", - "step": 1, + "step": 1.0, "type": "float" }, + { + "default": false, + "label": "Mirror", + "longdesc": "Mirrors the gradient", + "name": "mirror", + "shortdesc": "Mirror", + "type": "boolean" + }, { "default": { "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" @@ -85,7 +91,8 @@ "shortdesc": "Gradient", "type": "gradient" } - ] + ], + "shortdesc": "Circular Gradient" }, "type": "shader" -} \ No newline at end of file +} diff --git a/addons/material_maker/nodes/gradient.mmg b/addons/material_maker/nodes/gradient.mmg index 37f0f5f21..78946e51b 100644 --- a/addons/material_maker/nodes/gradient.mmg +++ b/addons/material_maker/nodes/gradient.mmg @@ -9,38 +9,37 @@ "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" }, - "repeat": 1, - "rotate": 0 + "mirror": false, + "repeat": 1.0, + "rotate": 0.0 }, "seed_int": 0, "shader_model": { "code": "float $(name_uv)_r = 0.5+(cos($rotate*0.01745329251)*($uv.x-0.5)+sin($rotate*0.01745329251)*($uv.y-0.5))/(cos(abs(mod($rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);", "global": "", - "inputs": [ - - ], + "inputs": [], "instance": "", "name": "Gradient", "outputs": [ { "longdesc": "An image showing the gradient", - "rgba": "$gradient(fract($(name_uv)_r*$repeat))", + "rgba": "$gradient($mirror ? 2.0*(0.5-abs(fract($(name_uv)_r*$repeat)-0.5)) : fract($(name_uv)_r*$repeat))", "shortdesc": "Output", "type": "rgba" } @@ -48,45 +47,53 @@ "parameters": [ { "control": "None", - "default": 1, + "default": 1.0, "label": "Repeat", "longdesc": "Number of repetitions of the gradient", - "max": 32, - "min": 1, + "max": 32.0, + "min": 1.0, "name": "repeat", "shortdesc": "Repeat", - "step": 1, + "step": 1.0, "type": "float" }, { "control": "Radius1.a", - "default": 0, + "default": 0.0, "label": "Rotate", "longdesc": "Angle of the gradient pattern", - "max": 180, - "min": -180, + "max": 180.0, + "min": -180.0, "name": "rotate", "shortdesc": "Rotate", "step": 0.1, "type": "float" }, + { + "default": false, + "label": "Mirror", + "longdesc": "Mirrors the gradient", + "name": "mirror", + "shortdesc": "Mirrors the gradient", + "type": "boolean" + }, { "default": { "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" @@ -100,4 +107,4 @@ ] }, "type": "shader" -} \ No newline at end of file +} diff --git a/addons/material_maker/nodes/radial_gradient.mmg b/addons/material_maker/nodes/radial_gradient.mmg index 557c2722a..6b9611487 100644 --- a/addons/material_maker/nodes/radial_gradient.mmg +++ b/addons/material_maker/nodes/radial_gradient.mmg @@ -9,38 +9,36 @@ "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" }, - "repeat": 1 + "mirror": false, + "repeat": 1.0 }, "seed_int": 0, "shader_model": { "code": "", "global": "", - "inputs": [ - - ], + "inputs": [], "instance": "", "name": "Radial Gradient", - "shortdesc": "Radial Gradient", "outputs": [ { "longdesc": "An image showing the gradient", - "rgba": "$gradient(fract($repeat*1.41421356237*length(fract($uv)-vec2(0.5, 0.5))))", + "rgba": "$gradient($mirror ? 2.0*(0.5-abs(fract(1.41421356237*length(fract($uv)-vec2(0.5, 0.5))*$repeat)-0.5)) : fract($repeat*1.41421356237*length(fract($uv)-vec2(0.5, 0.5))) )", "shortdesc": "Output", "type": "rgba" } @@ -48,33 +46,41 @@ "parameters": [ { "control": "None", - "default": 1, + "default": 1.0, "label": "Repeat", "longdesc": "Number of repetitions of the gradient", - "max": 32, - "min": 1, + "max": 32.0, + "min": 1.0, "name": "repeat", "shortdesc": "Repeat", - "step": 1, + "step": 1.0, "type": "float" }, + { + "default": false, + "label": "Mirror", + "longdesc": "Mirrors the gradient", + "name": "mirror", + "shortdesc": "Mirror", + "type": "boolean" + }, { "default": { "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" @@ -85,7 +91,8 @@ "shortdesc": "Gradient", "type": "gradient" } - ] + ], + "shortdesc": "Radial Gradient" }, "type": "shader" -} \ No newline at end of file +} diff --git a/addons/material_maker/nodes/spiral_gradient.mmg b/addons/material_maker/nodes/spiral_gradient.mmg index 9c3b3ea81..dd2ffc6aa 100644 --- a/addons/material_maker/nodes/spiral_gradient.mmg +++ b/addons/material_maker/nodes/spiral_gradient.mmg @@ -5,27 +5,28 @@ "y": 0 }, "parameters": { - "amount": 1, + "amount": 1.0, "gradient": { "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" }, + "mirror": false, "perspective": 0.3, "use_perspective": true }, @@ -41,16 +42,13 @@ " return fract(0.15915494309 * atan(uv.x, uv.y));", "}" ], - "inputs": [ - - ], + "inputs": [], "instance": "", "name": "Spiral Gradient", - "shortdesc": "Spiral Gradient", "outputs": [ { "longdesc": "Number of repetitions of the gradient", - "rgba": "$gradient(spiral_$(name_uv))", + "rgba": "$gradient($mirror ? 2.0*(0.5-abs(spiral_$(name_uv)-0.5)) : spiral_$(name_uv))", "shortdesc": "Gradient", "type": "rgba" } @@ -58,20 +56,20 @@ "parameters": [ { "control": "None", - "default": 1, + "default": 1.0, "label": "Repeat", - "max": 20, - "min": 0, + "max": 20.0, + "min": 0.0, "name": "amount", - "step": 1, + "step": 1.0, "type": "float" }, { "control": "Radius1.r", "default": 0.3, "label": "Zoom", - "max": 10, - "min": 0, + "max": 10.0, + "min": 0.0, "name": "perspective", "step": 0.01, "type": "float" @@ -82,23 +80,31 @@ "name": "use_perspective", "type": "boolean" }, + { + "default": false, + "label": "Mirror", + "longdesc": "Mirrors the gradient", + "name": "mirror", + "shortdesc": "Mirror", + "type": "boolean" + }, { "default": { "interpolation": 1, "points": [ { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 + "a": 1.0, + "b": 0.0, + "g": 0.0, + "pos": 0.0, + "r": 0.0 }, { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 + "a": 1.0, + "b": 1.0, + "g": 1.0, + "pos": 1.0, + "r": 1.0 } ], "type": "Gradient" @@ -109,7 +115,8 @@ "shortdesc": "Gradient", "type": "gradient" } - ] + ], + "shortdesc": "Spiral Gradient" }, "type": "shader" -} \ No newline at end of file +} diff --git a/material_maker/doc/images/node_simple_gradient.png b/material_maker/doc/images/node_simple_gradient.png index cab3a3b46..87778e5b7 100644 Binary files a/material_maker/doc/images/node_simple_gradient.png and b/material_maker/doc/images/node_simple_gradient.png differ diff --git a/material_maker/doc/images/node_simple_gradient_circular.png b/material_maker/doc/images/node_simple_gradient_circular.png index 8dac17ece..012211af9 100644 Binary files a/material_maker/doc/images/node_simple_gradient_circular.png and b/material_maker/doc/images/node_simple_gradient_circular.png differ diff --git a/material_maker/doc/images/node_simple_gradient_radial.png b/material_maker/doc/images/node_simple_gradient_radial.png index 998f0aa19..be4e2f067 100644 Binary files a/material_maker/doc/images/node_simple_gradient_radial.png and b/material_maker/doc/images/node_simple_gradient_radial.png differ diff --git a/material_maker/doc/images/node_simple_gradient_spiral.png b/material_maker/doc/images/node_simple_gradient_spiral.png index 670744b9a..d53a02bc1 100644 Binary files a/material_maker/doc/images/node_simple_gradient_spiral.png and b/material_maker/doc/images/node_simple_gradient_spiral.png differ diff --git a/material_maker/doc/node_simple_gradient.rst b/material_maker/doc/node_simple_gradient.rst index 4edba6991..ab5ebf257 100644 --- a/material_maker/doc/node_simple_gradient.rst +++ b/material_maker/doc/node_simple_gradient.rst @@ -22,11 +22,17 @@ Parameters The **Gradient** nodes accept the following parameters: -* the *number of repetitions* of the gradient -* the *rotation angle* (only for the linear **Gradient** node) -* the *perspective effect* (only for the spiral **Gradient** node) -* the *zoom* (only for the spiral **Gradient** node) -* the *gradient* +* **Number of repetitions** of the gradient + +* **Rotation angle** (only for the linear **Gradient** node) + +* **Perspective effect** (only for the spiral **Gradient** node) + +* **Zoom** (only for the spiral **Gradient** node) + +* **Mirror** which mirrors the **Gradient** + +* The **Gradient** Example images ++++++++++++++