diff --git a/game/addons/mat_maker_gd/nodes/common/sdf3d.gd b/game/addons/mat_maker_gd/nodes/common/sdf3d.gd index 71932915..bc4b2214 100644 --- a/game/addons/mat_maker_gd/nodes/common/sdf3d.gd +++ b/game/addons/mat_maker_gd/nodes/common/sdf3d.gd @@ -3,6 +3,21 @@ extends Reference const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") +#---------------------- +#sdf3d_box.mmg + +#Outputs: + +#Common +#vec3 $(name_uv)_q = abs($uv) - vec3($sx, $sy, $sz); + +#Output (sdf3d) - Shows the rounded box +#length(max($(name_uv)_q,0.0))+min(max($(name_uv)_q.x,max($(name_uv)_q.y,$(name_uv)_q.z)),0.0)-$r + +#Inputs: +#size, vector3, min: 0, max: 1, default:0.5, step:0.01 +#size, float, min: 0, max: 1, default:0.5, step:0.01 + static func raymarch(uv : Vector2) -> Color: var d : Vector2 = sdf3d_raymarch(uv); @@ -27,6 +42,9 @@ static func sdf3d_sphere(p : Vector3, r : float) -> Vector2: return Vector2(s, 0.0); +#vec3 $(name_uv)_q = abs($uv) - vec3($sx, $sy, $sz); +#length(max($(name_uv)_q,0.0))+min(max($(name_uv)_q.x,max($(name_uv)_q.y,$(name_uv)_q.z)),0.0)-$r + static func sdf3d_box(p : Vector3, sx : float, sy : float, sz : float, r : float) -> Vector2: var v : Vector3 = Commons.absv3((p)) - Vector3(sx, sy, sz); var f : float = (Commons.maxv3(v,Vector3())).length() + min(max(v.x,max(v.y, v.z)),0.0) - r; diff --git a/game/addons/mat_maker_gd/nodes/material_maker_nodes/sdf3d_box.mmg b/game/addons/mat_maker_gd/nodes/material_maker_nodes/sdf3d_box.mmg deleted file mode 100644 index 5669f44d..00000000 --- a/game/addons/mat_maker_gd/nodes/material_maker_nodes/sdf3d_box.mmg +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "sdf3d_box", - "node_position": { - "x": 0, - "y": 0 - }, - "parameters": { - "r": 0.01, - "sx": 0.3, - "sy": 0.25, - "sz": 0.25 - }, - "shader_model": { - "code": "vec3 $(name_uv)_q = abs($uv) - vec3($sx, $sy, $sz);\n", - "global": "", - "inputs": [ - - ], - "instance": "", - "longdesc": "Generates a rounded box as a signed distance function", - "name": "Box", - "outputs": [ - { - "longdesc": "Shows the rounded box", - "sdf3d": "length(max($(name_uv)_q,0.0))+min(max($(name_uv)_q.x,max($(name_uv)_q.y,$(name_uv)_q.z)),0.0)-$r", - "shortdesc": "Output", - "type": "sdf3d" - } - ], - "parameters": [ - { - "control": "Rect1.x", - "default": 0.5, - "label": "Size X", - "longdesc": "The size of the box along the X axis", - "max": 1, - "min": 0, - "name": "sx", - "shortdesc": "Size.x", - "step": 0.01, - "type": "float" - }, - { - "control": "Rect1.y", - "default": 0.5, - "label": "Size Y", - "longdesc": "The size of the box along the Y axis", - "max": 1, - "min": 0, - "name": "sy", - "shortdesc": "Size.y", - "step": 0.01, - "type": "float" - }, - { - "control": "None", - "default": 0.5, - "label": "Size Z", - "longdesc": "The size of the box along the Z axis", - "max": 1, - "min": 0, - "name": "sz", - "shortdesc": "Size.z", - "step": 0.01, - "type": "float" - }, - { - "control": "None", - "default": 0.5, - "label": "Radius", - "longdesc": "The radius of the rounded box", - "max": 1, - "min": 0, - "name": "r", - "shortdesc": "Radius", - "step": 0.01, - "type": "float" - } - ], - "shortdesc": "Box" - }, - "type": "shader" -} \ No newline at end of file