Notes from sdf3d_sphere.mmg.

This commit is contained in:
Relintai 2021-10-11 13:40:13 +02:00
parent 3f12c7c23e
commit 1a65e35471
2 changed files with 15 additions and 44 deletions

View File

@ -5,6 +5,7 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
#----------------------
#sdf3d_box.mmg
#Generates a rounded box as a signed distance function
#Outputs:
@ -18,6 +19,18 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
#size, vector3, min: 0, max: 1, default:0.5, step:0.01
#size, float, min: 0, max: 1, default:0.5, step:0.01
#----------------------
#sdf3d_sphere.mmg
#Generates a sphere as a signed distance function
#Outputs:
#Output (sdf3d) - Shows the sphere
#length($uv)-$r
#Inputs:
#radius, vector3, min: 0, max: 1, default:0.5, step:0.01
static func raymarch(uv : Vector2) -> Color:
var d : Vector2 = sdf3d_raymarch(uv);
@ -37,6 +50,8 @@ static func raymarch3(uv : Vector2) -> Color:
return Color(v.y, v.y, v.y, 1)
#length($uv)-$r
static func sdf3d_sphere(p : Vector3, r : float) -> Vector2:
var s : float = p.length() - r;

View File

@ -1,44 +0,0 @@
{
"name": "sdf3d_sphere",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"r": 0.4
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
],
"instance": "",
"longdesc": "Generates a sphere as a signed distance function",
"name": "Sphere",
"outputs": [
{
"longdesc": "Shows the sphere",
"sdf3d": "length($uv)-$r",
"shortdesc": "Output",
"type": "sdf3d"
}
],
"parameters": [
{
"control": "Radius1.r",
"default": 0.5,
"label": "",
"longdesc": "The radius of the sphere",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "Sphere"
},
"type": "shader"
}