From 950afb43e4a1f252ebfd1cc744d7677b5125eabb Mon Sep 17 00:00:00 2001 From: LMW Date: Tue, 26 May 2026 10:10:26 +0800 Subject: [PATCH] Added normalized option for sphere node --- addons/material_maker/nodes/sphere.mmg | 13 +++++++++++-- material_maker/doc/node_3d_sphere.rst | 7 +++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/material_maker/nodes/sphere.mmg b/addons/material_maker/nodes/sphere.mmg index d2c997e72..43207100d 100644 --- a/addons/material_maker/nodes/sphere.mmg +++ b/addons/material_maker/nodes/sphere.mmg @@ -7,6 +7,7 @@ "parameters": { "cx": 0.5, "cy": 0.5, + "normalized": false, "r": 0.5 }, "seed_int": 0, @@ -26,7 +27,7 @@ "name": "Sphere", "outputs": [ { - "f": "sphere($uv, vec2($cx, $cy), $r)", + "f": "sphere($uv, vec2($cx, $cy), $r) / ($normalized ? ($r * 2.0) : 1.0)", "longdesc": "A heightmap of the specified sphere", "shortdesc": "Output", "type": "f" @@ -68,9 +69,17 @@ "shortdesc": "Radius", "step": 0.01, "type": "float" + }, + { + "default": false, + "label": "Normalized", + "name": "normalized", + "shortdesc": "Normalized", + "longdesc": "Normalize output to 0.0 to 1.0 range", + "type": "boolean" } ], "shortdesc": "Sphere" }, "type": "shader" -} \ No newline at end of file +} diff --git a/material_maker/doc/node_3d_sphere.rst b/material_maker/doc/node_3d_sphere.rst index 265ff9217..d6e1ff019 100644 --- a/material_maker/doc/node_3d_sphere.rst +++ b/material_maker/doc/node_3d_sphere.rst @@ -20,8 +20,11 @@ selected 3D sphere. Parameters ++++++++++ -The **Sphere** node accepts the *sphere center position* as X and Y coordinates -and its *radius* as parameters. +The **Sphere** node accepts the following parameters: + +* the *shere center position* as X and Y coordinates +* the *radius* of the sphere +* whether output is *normalized* Example images ++++++++++++++