material-maker/addons/material_maker/examples/raymarching.ptex
2019-12-18 23:18:28 +01:00

389 lines
6.5 KiB
Plaintext

{
"connections": [
{
"from": "sdbox",
"from_port": 0,
"to": "sdboolean",
"to_port": 1
},
{
"from": "sdrhombus_2",
"from_port": 0,
"to": "sdboolean",
"to_port": 0
},
{
"from": "sdboolean",
"from_port": 0,
"to": "_4_2_3",
"to_port": 0
},
{
"from": "_4_2_3",
"from_port": 0,
"to": "sdf3d_revolution",
"to_port": 0
},
{
"from": "sdf3d_revolution",
"from_port": 0,
"to": "sdrotate",
"to_port": 0
},
{
"from": "raymarching",
"from_port": 1,
"to": "Material",
"to_port": 4
},
{
"from": "sdrotate",
"from_port": 0,
"to": "raymarching",
"to_port": 0
},
{
"from": "uniform",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{
"from": "uniform",
"from_port": 0,
"to": "Material",
"to_port": 1
}
],
"label": "Graph",
"name": "49",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"name": "Material",
"node_position": {
"x": -336,
"y": 266
},
"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": "sdrotate",
"node_position": {
"x": -722.057617,
"y": 347.909668
},
"parameters": {
"a": 0,
"ax": 18,
"ay": -28,
"az": -29,
"x": 0.35,
"y": 0,
"z": 0
},
"shader_model": {
"code": "",
"global": "vec3 rotate3d(vec3 p, vec3 a) {\n\tvec3 rv;\n\tfloat c;\n\tfloat s;\n\tc = cos(a.x);\n\ts = sin(a.x);\n\trv.x = p.x;\n\trv.y = p.y*c+p.z*s;\n\trv.z = -p.y*s+p.z*c;\n\tc = cos(a.y);\n\ts = sin(a.y);\n\tp.x = rv.x*c+rv.z*s;\n\tp.y = rv.y;\n\tp.z = -rv.x*s+rv.z*c;\n\tc = cos(a.z);\n\ts = sin(a.z);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\trv.z = p.z;\n\treturn rv;\n}\n",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf3d"
}
],
"instance": "",
"name": "Rotate",
"outputs": [
{
"sdf3d": "$in(rotate3d($uv, -vec3($ax, $ay, $az)*0.01745329251))",
"type": "sdf3d"
}
],
"parameters": [
{
"default": 0,
"label": "X",
"max": 180,
"min": -180,
"name": "ax",
"step": 1,
"type": "float"
},
{
"default": 0,
"label": "Y",
"max": 180,
"min": -180,
"name": "ay",
"step": 1,
"type": "float"
},
{
"default": 0,
"label": "Z",
"max": 180,
"min": -180,
"name": "az",
"step": 1,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "sdrhombus_2",
"node_position": {
"x": -1116.057617,
"y": 261.159668
},
"parameters": {
"cx": 0,
"cy": 0,
"h": 0.29,
"r": 0.3,
"w": 0.3
},
"type": "sdrhombus"
},
{
"name": "sdbox",
"node_position": {
"x": -1119.057617,
"y": 401.159668
},
"parameters": {
"cx": 0,
"cy": 0,
"h": 0.2,
"r": 0.3,
"w": 0.2
},
"shader_model": {
"code": "vec2 $(name_uv)_d = abs($uv-0.5*vec2($cx+1.0, $cy+1.0))-vec2($w, $h);\n",
"global": "",
"inputs": [
],
"instance": "",
"name": "sdBox",
"outputs": [
{
"sdf2d": "length(max($(name_uv)_d,vec2(0)))+min(max($(name_uv)_d.x,$(name_uv)_d.y),0.0)",
"type": "sdf2d"
}
],
"parameters": [
{
"default": 0.5,
"label": "Width",
"max": 1,
"min": 0,
"name": "w",
"step": 0.01,
"type": "float"
},
{
"default": 1,
"label": "Height",
"max": 1,
"min": 0,
"name": "h",
"step": 0.01,
"type": "float"
},
{
"default": 0,
"label": "Center X",
"max": 1,
"min": -1,
"name": "cx",
"step": 0.01,
"type": "float"
},
{
"default": 0,
"label": "Center Y",
"max": 1,
"min": -1,
"name": "cy",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "sdboolean",
"node_position": {
"x": -894.057617,
"y": 297.159668
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 0,
"r": 0.3,
"w": 0.28
},
"type": "sdboolean"
},
{
"name": "_4_2_3",
"node_position": {
"x": -903.047241,
"y": 363.697357
},
"parameters": {
"x": 0,
"y": 0,
"z": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "Translate",
"outputs": [
{
"sdf2d": "$in($uv-vec2($x, $y))",
"type": "sdf2d"
}
],
"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"
}
]
},
"type": "shader"
},
{
"name": "sdf3d_revolution",
"node_position": {
"x": -714.403931,
"y": 295.330994
},
"parameters": {
"a": 0,
"d": 0.43,
"s": 1,
"x": 0.35,
"y": 0,
"z": 0
},
"shader_model": {
"code": "vec2 $(name_uv)_w = vec2($in($uv.xz+vec2(0.5)),abs($uv.y)-$d);\n",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "Extrusion",
"outputs": [
{
"sdf3d": "min(max($(name_uv)_w.x,$(name_uv)_w.y),0.0)+length(max($(name_uv)_w,0.0))",
"type": "sdf3d"
}
],
"parameters": [
{
"default": 0.25,
"label": "",
"max": 1,
"min": 0,
"name": "d",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "raymarching",
"node_position": {
"x": -522.23468,
"y": 348.748474
},
"parameters": {
},
"type": "raymarching"
},
{
"name": "uniform",
"node_position": {
"x": -576.760742,
"y": 211.755493
},
"parameters": {
"color": {
"a": 1,
"b": 1,
"g": 0.415686,
"r": 0,
"type": "Color"
}
},
"type": "uniform"
}
],
"parameters": {
},
"type": "graph"
}