mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
e919507f06
- Added signed distance functions 2D and 2D input/output types - Updated SDF2D nodes to used SDF2D inputs/outputs - Added preview code for SDF2D and SDF3D - Updates all SDF2D templates - Added basic SDF3D nodes
664 lines
11 KiB
Plaintext
664 lines
11 KiB
Plaintext
{
|
|
"connections": [
|
|
{
|
|
"from": "_3",
|
|
"from_port": 1,
|
|
"to": "Material",
|
|
"to_port": 4
|
|
},
|
|
{
|
|
"from": "perlin",
|
|
"from_port": 0,
|
|
"to": "colorize",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "colorize",
|
|
"from_port": 0,
|
|
"to": "Material",
|
|
"to_port": 2
|
|
},
|
|
{
|
|
"from": "sdf3d_sphere",
|
|
"from_port": 0,
|
|
"to": "_4",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "sdf3d_sphere",
|
|
"from_port": 0,
|
|
"to": "_4_2",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "_4",
|
|
"from_port": 0,
|
|
"to": "sdf3d_boolean",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "_4_2",
|
|
"from_port": 0,
|
|
"to": "sdf3d_boolean",
|
|
"to_port": 1
|
|
},
|
|
{
|
|
"from": "sdf3d_boolean",
|
|
"from_port": 0,
|
|
"to": "_4_2_2",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "_4_2_2",
|
|
"from_port": 0,
|
|
"to": "sdf3d_smoothboolean",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "sdf3d_box",
|
|
"from_port": 0,
|
|
"to": "sdf3d_smoothboolean",
|
|
"to_port": 1
|
|
},
|
|
{
|
|
"from": "sdf3d_torus",
|
|
"from_port": 0,
|
|
"to": "_4_2_2_2",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "sdf3d_smoothboolean",
|
|
"from_port": 0,
|
|
"to": "sdf3d_smoothboolean_2",
|
|
"to_port": 1
|
|
},
|
|
{
|
|
"from": "_4_2_2_2",
|
|
"from_port": 0,
|
|
"to": "sdf3d_smoothboolean_2",
|
|
"to_port": 0
|
|
},
|
|
{
|
|
"from": "sdf3d_smoothboolean_2",
|
|
"from_port": 0,
|
|
"to": "_3",
|
|
"to_port": 0
|
|
}
|
|
],
|
|
"label": "Graph",
|
|
"name": "49",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"nodes": [
|
|
{
|
|
"name": "Material",
|
|
"node_position": {
|
|
"x": -36,
|
|
"y": -273
|
|
},
|
|
"parameters": {
|
|
"albedo_color": {
|
|
"a": 1,
|
|
"b": 1,
|
|
"g": 1,
|
|
"r": 1,
|
|
"type": "Color"
|
|
},
|
|
"ao_light_affect": 1,
|
|
"depth_scale": 1,
|
|
"emission_energy": 1,
|
|
"metallic": 1,
|
|
"normal_scale": 1,
|
|
"roughness": 1,
|
|
"size": 11,
|
|
"subsurf_scatter_strength": 0
|
|
},
|
|
"type": "material"
|
|
},
|
|
{
|
|
"name": "_3",
|
|
"node_position": {
|
|
"x": -424.5,
|
|
"y": -165
|
|
},
|
|
"parameters": {
|
|
|
|
},
|
|
"shader_model": {
|
|
"code": "float $(name_uv)_d = raymarch_$name($uv);\n",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"function": true,
|
|
"label": "",
|
|
"name": "sdf",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "float input_$name(vec3 p) {\n\treturn min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec2 uv) {\n\tvec3 ro = vec3(uv-vec2(0.5), 1.0);\n\tvec3 rd = vec3(0.0, 0.0, -1.0);\n\tfloat dO=0.;\n \n for (int i=0; i < 50; i++) {\n \tvec3 p = ro + rd*dO;\n float dS = input_$name(p);\n dO += dS;\n if (dO > 0.001 && dS < 0.0001) break;\n }\n \n return dO;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = input_$name(p);\n float e = .001;\n \n vec3 n = d - vec3(\n input_$name(p-vec3(e, 0.0, 0.0)),\n input_$name(p-vec3(0.0, e, 0.0)),\n input_$name(p-vec3(0.0, 0.0, e)));\n \n return vec3(-1.0, -1.0, -1.0)*normalize(n);\n}\n\n",
|
|
"name": "Raymarching",
|
|
"outputs": [
|
|
{
|
|
"f": "1.0-$(name_uv)_d",
|
|
"type": "f"
|
|
},
|
|
{
|
|
"rgb": "vec3(0.5)+0.5*normal_$name(vec3($uv-vec2(0.5), 1.0-$(name_uv)_d))",
|
|
"type": "rgb"
|
|
}
|
|
],
|
|
"parameters": [
|
|
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "perlin",
|
|
"node_position": {
|
|
"x": -511.535645,
|
|
"y": -348.25
|
|
},
|
|
"parameters": {
|
|
"iterations": 5,
|
|
"persistence": 0.5,
|
|
"scale_x": 4,
|
|
"scale_y": 4
|
|
},
|
|
"type": "perlin"
|
|
},
|
|
{
|
|
"name": "colorize",
|
|
"node_position": {
|
|
"x": -260.535645,
|
|
"y": -304.25
|
|
},
|
|
"parameters": {
|
|
"gradient": {
|
|
"interpolation": 1,
|
|
"points": [
|
|
{
|
|
"a": 1,
|
|
"b": 0.088542,
|
|
"g": 0.088542,
|
|
"pos": 0,
|
|
"r": 0.088542
|
|
},
|
|
{
|
|
"a": 1,
|
|
"b": 0.494792,
|
|
"g": 0.494792,
|
|
"pos": 0.990909,
|
|
"r": 0.494792
|
|
},
|
|
{
|
|
"a": 1,
|
|
"b": 0.338542,
|
|
"g": 0.338542,
|
|
"pos": 1,
|
|
"r": 0.338542
|
|
}
|
|
],
|
|
"type": "Gradient"
|
|
}
|
|
},
|
|
"type": "colorize"
|
|
},
|
|
{
|
|
"name": "_4",
|
|
"node_position": {
|
|
"x": -1008.238525,
|
|
"y": -303.85495
|
|
},
|
|
"parameters": {
|
|
"x": -0.17,
|
|
"y": 0,
|
|
"z": 0
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "Translate",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "$in($uv+vec3($x, $y, $z))",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "X",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "x",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Y",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "y",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Z",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "z",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "sdf3d_boolean",
|
|
"node_position": {
|
|
"x": -821.049805,
|
|
"y": -365.10495
|
|
},
|
|
"parameters": {
|
|
"bevel": 0,
|
|
"cx": 0,
|
|
"cy": 0,
|
|
"h": 0.08,
|
|
"op": 0,
|
|
"r": 0.3,
|
|
"w": 0.28
|
|
},
|
|
"type": "sdf3d_boolean"
|
|
},
|
|
{
|
|
"name": "sdf3d_box",
|
|
"node_position": {
|
|
"x": -1025.376221,
|
|
"y": -92.60495
|
|
},
|
|
"parameters": {
|
|
"r": 0.26,
|
|
"sx": 0.1,
|
|
"sy": 0.1,
|
|
"sz": 0.02
|
|
},
|
|
"shader_model": {
|
|
"code": "vec3 $(name_uv)_q = abs($uv) - vec3($sx, $sy, $sz);\n",
|
|
"global": "",
|
|
"inputs": [
|
|
|
|
],
|
|
"instance": "",
|
|
"name": "Box",
|
|
"outputs": [
|
|
{
|
|
"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",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0.5,
|
|
"label": "Size X",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "sx",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "Size Y",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "sy",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "Size Z",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "sz",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "Radius",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "r",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "sdf3d_torus",
|
|
"node_position": {
|
|
"x": -819.376282,
|
|
"y": -100.60495
|
|
},
|
|
"parameters": {
|
|
"R": 0.38,
|
|
"a1": 0.5,
|
|
"a2": 0.865,
|
|
"r": 0.03,
|
|
"sx": 0.1,
|
|
"sy": 0.1,
|
|
"sz": 0.02
|
|
},
|
|
"shader_model": {
|
|
"code": "\n",
|
|
"global": "float sdf3CappedTorus(vec3 p, float R, float r, vec2 sc) {\n\tp.x = abs(p.x);\n\tfloat k = (sc.y*p.x>sc.x*p.y)?dot(p.xy,sc):length(p.xy);\n\treturn sqrt(dot(p,p)+R*R-2.0*R*k)-r;\n}\n",
|
|
"inputs": [
|
|
|
|
],
|
|
"instance": "",
|
|
"name": "Capped Torus",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "sdf3CappedTorus($uv, $R, $r, vec2($a1, $a2))",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0.5,
|
|
"label": "R",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "R",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.1,
|
|
"label": "r",
|
|
"max": 0.5,
|
|
"min": 0,
|
|
"name": "r",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "A1",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "a1",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "A2",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "a2",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "sdf3d_smoothboolean",
|
|
"node_position": {
|
|
"x": -822.049805,
|
|
"y": -189.10495
|
|
},
|
|
"parameters": {
|
|
"bevel": 0,
|
|
"cx": 0,
|
|
"cy": 0,
|
|
"h": 0.08,
|
|
"k": 0.02,
|
|
"op": 1,
|
|
"r": 0.3,
|
|
"w": 0.28
|
|
},
|
|
"type": "sdf3d_smoothboolean"
|
|
},
|
|
{
|
|
"name": "_4_2",
|
|
"node_position": {
|
|
"x": -1004.406982,
|
|
"y": -196.60495
|
|
},
|
|
"parameters": {
|
|
"x": 0.17,
|
|
"y": 0,
|
|
"z": 0
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "Translate",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "$in($uv+vec3($x, $y, $z))",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "X",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "x",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Y",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "y",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Z",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "z",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "_4_2_2",
|
|
"node_position": {
|
|
"x": -808.049805,
|
|
"y": -300.60495
|
|
},
|
|
"parameters": {
|
|
"x": 0,
|
|
"y": 0.14,
|
|
"z": -0.23
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "Translate",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "$in($uv+vec3($x, $y, $z))",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "X",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "x",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Y",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "y",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Z",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "z",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "_4_2_2_2",
|
|
"node_position": {
|
|
"x": -813.069458,
|
|
"y": 32.162903
|
|
},
|
|
"parameters": {
|
|
"x": 0,
|
|
"y": 0.19,
|
|
"z": -0.23
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "Translate",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "$in($uv+vec3($x, $y, $z))",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "X",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "x",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Y",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "y",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Z",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "z",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
},
|
|
{
|
|
"name": "sdf3d_smoothboolean_2",
|
|
"node_position": {
|
|
"x": -621.569458,
|
|
"y": -171.337097
|
|
},
|
|
"parameters": {
|
|
"bevel": 0,
|
|
"cx": 0,
|
|
"cy": 0,
|
|
"h": 0.08,
|
|
"k": 0.04,
|
|
"op": 1,
|
|
"r": 0.3,
|
|
"w": 0.28
|
|
},
|
|
"type": "sdf3d_smoothboolean"
|
|
},
|
|
{
|
|
"name": "sdf3d_sphere",
|
|
"node_position": {
|
|
"x": -1000.049805,
|
|
"y": -359.10495
|
|
},
|
|
"parameters": {
|
|
"r": 0.07
|
|
},
|
|
"type": "sdf3d_sphere"
|
|
}
|
|
],
|
|
"parameters": {
|
|
|
|
},
|
|
"type": "graph"
|
|
} |