mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Comments from sdf3d_cylinder.mmg.
This commit is contained in:
parent
2eabdc5536
commit
55c23bc6b2
@ -104,7 +104,18 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
#in, vec2, default:vec2(100, 0.0), (sdf3d input)
|
||||
#rotation, vector3, min: -180, max: 180, default:0, step:1
|
||||
|
||||
#----------------------
|
||||
#sdf3d_cylinder.mmg
|
||||
|
||||
#Outputs:
|
||||
|
||||
#Output (sdf3dc) - Shows the cylinder
|
||||
#min(max($(name_uv)_d.x,$(name_uv)_d.y),0.0) + length(max($(name_uv)_d,0.0))
|
||||
|
||||
#Inputs:
|
||||
#axis, enum, default: 1, values: X, Y, Z
|
||||
#length, float, min: 0, max: 1, default:0.5, step:0.01
|
||||
#radius, float, min: 0, max: 1, default:0.2, step:0.01
|
||||
|
||||
static func raymarch(uv : Vector2) -> Color:
|
||||
var d : Vector2 = sdf3d_raymarch(uv);
|
||||
@ -141,18 +152,27 @@ static func sdf3d_box(p : Vector3, sx : float, sy : float, sz : float, r : float
|
||||
|
||||
return Vector2(f, 0.0);
|
||||
|
||||
#Y: $axis = length($uv.xz),$uv.y
|
||||
#vec2 $(name_uv)_d = abs(vec2($axis)) - vec2($r,$l);
|
||||
|
||||
static func sdf3d_cylinder_y(p : Vector3, r : float, l : float) -> Vector2:
|
||||
var v : Vector2 = Commons.absv2(Vector2(Vector2(p.x, p.z).length(),(p).y)) - Vector2(r,l);
|
||||
var f : float = min(max(v.x, v.y),0.0) + Commons.maxv2(v, Vector2()).length();
|
||||
|
||||
return Vector2(f, 0.0);
|
||||
|
||||
#X: $axis = length($uv.yz),$uv.x
|
||||
#vec2 $(name_uv)_d = abs(vec2($axis)) - vec2($r,$l);
|
||||
|
||||
static func sdf3d_cylinder_x(p : Vector3, r : float, l : float) -> Vector2:
|
||||
var v : Vector2 = Commons.absv2(Vector2(Vector2(p.y, p.z).length(),(p).x)) - Vector2(r, l);
|
||||
var f : float = min(max(v.x, v.y),0.0) + Commons.maxv2(v, Vector2()).length();
|
||||
|
||||
return Vector2(f, 0.0);
|
||||
|
||||
#Z: $axis = length($uv.xy),$uv.z
|
||||
#vec2 $(name_uv)_d = abs(vec2($axis)) - vec2($r,$l);
|
||||
|
||||
static func sdf3d_cylinder_z(p : Vector3, r : float, l : float) -> Vector2:
|
||||
var v : Vector2 = Commons.absv2(Vector2(Vector2(p.x, p.y).length(),(p).z)) - Vector2(r, l);
|
||||
var f : float = min(max(v.x, v.y),0.0) + Commons.maxv2(v, Vector2()).length();
|
||||
|
@ -1,80 +0,0 @@
|
||||
{
|
||||
"name": "sdf3d_cylinder",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"axis": 1,
|
||||
"l": 0.25,
|
||||
"r": 0.25
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_d = abs(vec2($axis)) - vec2($r,$l);\n",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates a cylinder as a signed distance function",
|
||||
"name": "Cylinder",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the cylinder",
|
||||
"sdf3d": "min(max($(name_uv)_d.x,$(name_uv)_d.y),0.0) + length(max($(name_uv)_d,0.0))",
|
||||
"shortdesc": "Output",
|
||||
"type": "sdf3d"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 1,
|
||||
"label": "Axis",
|
||||
"longdesc": "The axis of the cylinder",
|
||||
"name": "axis",
|
||||
"shortdesc": "Axis",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "X",
|
||||
"value": "length($uv.yz),$uv.x"
|
||||
},
|
||||
{
|
||||
"name": "Y",
|
||||
"value": "length($uv.xz),$uv.y"
|
||||
},
|
||||
{
|
||||
"name": "Z",
|
||||
"value": "length($uv.xy),$uv.z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "Rect1.y",
|
||||
"default": 0.5,
|
||||
"label": "Length",
|
||||
"longdesc": "The length of the cylinder",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "l",
|
||||
"shortdesc": "Length",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "Rect1.x",
|
||||
"default": 0.2,
|
||||
"label": "Radius",
|
||||
"longdesc": "The radius of the cylinder",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "r",
|
||||
"shortdesc": "Radius",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Cylinder"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
Loading…
Reference in New Issue
Block a user