mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
Notes from sdf3d_sphere.mmg.
This commit is contained in:
parent
3f12c7c23e
commit
1a65e35471
@ -5,6 +5,7 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
|||||||
|
|
||||||
#----------------------
|
#----------------------
|
||||||
#sdf3d_box.mmg
|
#sdf3d_box.mmg
|
||||||
|
#Generates a rounded box as a signed distance function
|
||||||
|
|
||||||
#Outputs:
|
#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, vector3, min: 0, max: 1, default:0.5, step:0.01
|
||||||
#size, float, 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:
|
static func raymarch(uv : Vector2) -> Color:
|
||||||
var d : Vector2 = sdf3d_raymarch(uv);
|
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)
|
return Color(v.y, v.y, v.y, 1)
|
||||||
|
|
||||||
|
#length($uv)-$r
|
||||||
|
|
||||||
static func sdf3d_sphere(p : Vector3, r : float) -> Vector2:
|
static func sdf3d_sphere(p : Vector3, r : float) -> Vector2:
|
||||||
var s : float = p.length() - r;
|
var s : float = p.length() - r;
|
||||||
|
|
||||||
|
@ -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"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user