Skip to content

Commit 560e8f4

Browse files
authored
Added normalized option for Sphere node (contributed by williamchange)
Add normalized option for sphere node
2 parents 8911e07 + 950afb4 commit 560e8f4

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

addons/material_maker/nodes/sphere.mmg

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"parameters": {
88
"cx": 0.5,
99
"cy": 0.5,
10+
"normalized": false,
1011
"r": 0.5
1112
},
1213
"seed_int": 0,
@@ -26,7 +27,7 @@
2627
"name": "Sphere",
2728
"outputs": [
2829
{
29-
"f": "sphere($uv, vec2($cx, $cy), $r)",
30+
"f": "sphere($uv, vec2($cx, $cy), $r) / ($normalized ? ($r * 2.0) : 1.0)",
3031
"longdesc": "A heightmap of the specified sphere",
3132
"shortdesc": "Output",
3233
"type": "f"
@@ -68,9 +69,17 @@
6869
"shortdesc": "Radius",
6970
"step": 0.01,
7071
"type": "float"
72+
},
73+
{
74+
"default": false,
75+
"label": "Normalized",
76+
"name": "normalized",
77+
"shortdesc": "Normalized",
78+
"longdesc": "Normalize output to 0.0 to 1.0 range",
79+
"type": "boolean"
7180
}
7281
],
7382
"shortdesc": "Sphere"
7483
},
7584
"type": "shader"
76-
}
85+
}

material_maker/doc/node_3d_sphere.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ selected 3D sphere.
2020
Parameters
2121
++++++++++
2222

23-
The **Sphere** node accepts the *sphere center position* as X and Y coordinates
24-
and its *radius* as parameters.
23+
The **Sphere** node accepts the following parameters:
24+
25+
* the *shere center position* as X and Y coordinates
26+
* the *radius* of the sphere
27+
* whether output is *normalized*
2528

2629
Example images
2730
++++++++++++++

0 commit comments

Comments
 (0)