material-maker/addons/material_maker/nodes/sphere.mmg

68 lines
1.3 KiB
Plaintext
Raw Normal View History

{
"name": "sphere",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"r": 0.5
},
"shader_model": {
"code": "",
"global": "float sphere(vec2 uv, vec2 c, float r) {\n\tuv -= c;\n\tuv /= r;\n\treturn 2.0*r*sqrt(max(0.0, 1.0-dot(uv, uv)));\n}\n",
"inputs": [
],
"instance": "",
"name": "Sphere",
"outputs": [
{
"f": "sphere($uv, vec2($cx, $cy), $r)",
"longdesc": "A heightmap of the specified sphere",
"shortdesc": "Output",
"type": "f"
}
],
"parameters": [
{
"control": "None",
"default": 0.5,
"label": "Center X",
"longdesc": "Position of the center along the X axis",
"max": 1,
"min": 0,
"name": "cx",
"shortdesc": "Center.x",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0.5,
"label": "Center Y",
"longdesc": "Position of the center along the Y axis",
"max": 1,
"min": 0,
"name": "cy",
"shortdesc": "Center.y",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0.5,
"label": "Radius",
"longdesc": "Radius of the sphere",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}