Updated examples

This commit is contained in:
RodZill4 2020-01-11 23:12:04 +01:00
parent 836b43da3c
commit 0ca3a81022
3 changed files with 154 additions and 48 deletions

View File

@ -42,12 +42,6 @@
"to": "blend", "to": "blend",
"to_port": 2 "to_port": 2
}, },
{
"from": "graph",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{ {
"from": "raymarching_2", "from": "raymarching_2",
"from_port": 0, "from_port": 0,
@ -95,6 +89,18 @@
"from_port": 0, "from_port": 0,
"to": "raymarching_2_2", "to": "raymarching_2_2",
"to_port": 0 "to_port": 0
},
{
"from": "sphere",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{
"from": "graph_3_2",
"from_port": 0,
"to": "raymarching",
"to_port": 0
} }
], ],
"label": "Graph", "label": "Graph",
@ -963,9 +969,11 @@
"parameters": { "parameters": {
"bevel": 0.1, "bevel": 0.1,
"columns": 3, "columns": 3,
"corner": 0,
"mortar": 0.1, "mortar": 0.1,
"pattern": 0, "pattern": 0,
"repeat": 1, "repeat": 1,
"round": 0,
"row_offset": 0.5, "row_offset": 0.5,
"rows": 6 "rows": 6
}, },
@ -1025,8 +1033,8 @@
{ {
"name": "raymarching", "name": "raymarching",
"node_position": { "node_position": {
"x": 242.468536, "x": 172.468536,
"y": 27.145508 "y": -196.854492
}, },
"parameters": { "parameters": {
@ -1043,11 +1051,11 @@
"type": "sdf3d" "type": "sdf3d"
} }
], ],
"instance": "float input_$name(vec3 p) {\n\tif (p.z > 0.0) {\n\t\treturn $sdf(p);\n\t} else {\n\t\treturn p.z;\n\t}\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat dO=0.; \n for (int i=0; i < 25; i++) {\n \tvec3 p = ro + rd*dO;\n float dS = input_$name(p);\n dO += dS;\n if (dO > 1.0 || 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(input_$name(p-vec3(e, 0.0, 0.0)), input_$name(p-vec3(0.0, e, 0.0)), input_$name(p-vec3(0.0, 0.0, e)));\n return vec3(-1.0, -1.0, -1.0)*normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturnvec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n", "instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Render3d", "name": "Render3d",
"outputs": [ "outputs": [
{ {
"rgb": "render_$name($uv-vec2(0.5));\n", "rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb" "type": "rgb"
} }
], ],
@ -2374,6 +2382,35 @@
"z": 0.25 "z": 0.25
}, },
"type": "sdf3d_translate" "type": "sdf3d_translate"
},
{
"name": "sphere",
"node_position": {
"x": 226.260986,
"y": -38.970337
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"r": 0.5
},
"type": "sphere"
},
{
"name": "sdf3d_extrusion",
"node_position": {
"x": -69.41095,
"y": -191.970337
},
"parameters": {
"a": 0,
"d": -0.53,
"s": 1,
"x": 0.35,
"y": 0,
"z": 0
},
"type": "sdf3d_extrusion"
} }
], ],
"parameters": { "parameters": {

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/doc_tools_albedo.png-7c4191d26c2e3665ccb8c2f5268f0b3d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/material_maker/examples/doc_tools_albedo.png"
dest_files=[ "res://.import/doc_tools_albedo.png-7c4191d26c2e3665ccb8c2f5268f0b3d.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -216,18 +216,6 @@
"to": "mwf_create_map_2_2_2", "to": "mwf_create_map_2_2_2",
"to_port": 0 "to_port": 0
}, },
{
"from": "mwf_create_map_2_2_2_2",
"from_port": 0,
"to": "mwf_map",
"to_port": 0
},
{
"from": "graph_5",
"from_port": 0,
"to": "mwf_create_map_2_2_2_2",
"to_port": 0
},
{ {
"from": "colorize_6", "from": "colorize_6",
"from_port": 0, "from_port": 0,
@ -287,6 +275,30 @@
"from_port": 0, "from_port": 0,
"to": "mwf_mix_maps", "to": "mwf_mix_maps",
"to_port": 3 "to_port": 3
},
{
"from": "graph_5",
"from_port": 0,
"to": "mwf_create_map_3",
"to_port": 0
},
{
"from": "graph_5",
"from_port": 1,
"to": "mwf_create_map_3",
"to_port": 1
},
{
"from": "mwf_create_map_3",
"from_port": 0,
"to": "mwf_map",
"to_port": 0
},
{
"from": "normal_map",
"from_port": 0,
"to": "brightness_contrast",
"to_port": 0
} }
], ],
"label": "Graph", "label": "Graph",
@ -2217,6 +2229,12 @@
"from_port": 0, "from_port": 0,
"to": "colorize_4", "to": "colorize_4",
"to_port": 0 "to_port": 0
},
{
"from": "bricks_2",
"from_port": 1,
"to": "gen_outputs",
"to_port": 1
} }
], ],
"label": "Bricks", "label": "Bricks",
@ -2229,8 +2247,8 @@
{ {
"name": "bricks_2", "name": "bricks_2",
"node_position": { "node_position": {
"x": 611.874512, "x": 640.874512,
"y": -790.245544 "y": -780.245544
}, },
"parameters": { "parameters": {
"bevel": 0.04, "bevel": 0.04,
@ -2248,8 +2266,8 @@
{ {
"name": "colorize_4", "name": "colorize_4",
"node_position": { "node_position": {
"x": 881.814941, "x": 924.814941,
"y": -686.245544 "y": -802.245544
}, },
"parameters": { "parameters": {
"gradient": { "gradient": {
@ -2285,8 +2303,8 @@
{ {
"name": "blend", "name": "blend",
"node_position": { "node_position": {
"x": 846.98291, "x": 899.98291,
"y": -783.245544 "y": -893.245544
}, },
"parameters": { "parameters": {
"amount": 1, "amount": 1,
@ -2311,8 +2329,8 @@
{ {
"name": "gen_outputs", "name": "gen_outputs",
"node_position": { "node_position": {
"x": 1167.814941, "x": 1132.814941,
"y": -768.578857 "y": -778.578857
}, },
"parameters": { "parameters": {
@ -2320,7 +2338,11 @@
"ports": [ "ports": [
{ {
"name": "port0", "name": "port0",
"type": "rgba" "type": "f"
},
{
"name": "unnamed",
"type": "f"
} }
], ],
"type": "ios" "type": "ios"
@ -2328,8 +2350,8 @@
{ {
"name": "gen_parameters", "name": "gen_parameters",
"node_position": { "node_position": {
"x": 767.557434, "x": 976.557434,
"y": -896.245605 "y": -981.245605
}, },
"parameters": { "parameters": {
@ -2540,7 +2562,7 @@
"y": 478.266724 "y": 478.266724
}, },
"parameters": { "parameters": {
"param0": 0.3, "param0": 0.5,
"param1": 10, "param1": 10,
"param2": 2 "param2": 2
}, },
@ -2608,7 +2630,7 @@
"name": "mwf_create_map_2_2_2", "name": "mwf_create_map_2_2_2",
"node_position": { "node_position": {
"x": -1893.537354, "x": -1893.537354,
"y": 484.516724 "y": 481.516724
}, },
"parameters": { "parameters": {
"angle": 45, "angle": 45,
@ -2616,18 +2638,6 @@
}, },
"type": "mwf_create_map" "type": "mwf_create_map"
}, },
{
"name": "mwf_create_map_2_2_2_2",
"node_position": {
"x": -1796.537354,
"y": 589.266724
},
"parameters": {
"angle": 0,
"height": 1
},
"type": "mwf_create_map"
},
{ {
"name": "normal_map", "name": "normal_map",
"node_position": { "node_position": {
@ -2637,7 +2647,7 @@
"parameters": { "parameters": {
"amount": 0.5, "amount": 0.5,
"param0": 10, "param0": 10,
"param1": 1.02, "param1": 0.78,
"param2": 0, "param2": 0,
"param3": 0, "param3": 0,
"param4": 1, "param4": 1,
@ -2673,6 +2683,31 @@
"height": 0.8 "height": 0.8
}, },
"type": "mwf_mix_maps" "type": "mwf_mix_maps"
},
{
"name": "mwf_create_map_3",
"node_position": {
"x": -1823.445557,
"y": 586.679321
},
"parameters": {
"angle": 0,
"height": 1
},
"type": "mwf_create_map"
},
{
"name": "brightness_contrast",
"node_position": {
"x": -1468.755005,
"y": 754.429321
},
"parameters": {
"brightness": 0,
"contrast": 1,
"steps": 6
},
"type": "brightness_contrast"
} }
], ],
"parameters": { "parameters": {