Added more raymarching nodes and examples

This commit is contained in:
RodZill4 2019-12-18 22:36:44 +01:00
parent 864e4e9fe8
commit b7fb257d4c
4 changed files with 3512 additions and 40 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
{
"name": "sdf3d_circle_repeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"a": 0,
"c": 4,
"r": 0.24,
"rx": 4,
"ry": 4,
"s": 0.3,
"x": 0.35,
"y": 0,
"z": 0
},
"shader_model": {
"code": "",
"global": "vec3 circle_repeat_transform(vec3 p, float count) {\n\tfloat r = 6.28/count;\n\tfloat pa = atan(p.x, p.y);\n\tfloat a = mod(pa+0.5*r, r)-0.5*r;\n\tvec3 rv;\n\tfloat c = cos(a-pa);\n\tfloat s = sin(a-pa);\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": "Circle Repeat",
"outputs": [
{
"sdf3d": "$in(circle_repeat_transform($uv, $c))",
"type": "sdf3d"
}
],
"parameters": [
{
"default": 4,
"label": "",
"max": 32,
"min": 1,
"name": "c",
"step": 1,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,67 @@
{
"name": "sdf3d_repeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"a": 0,
"r": 0.24,
"rx": 4,
"ry": 4,
"s": 0.3,
"x": 0.35,
"y": 0,
"z": 0
},
"shader_model": {
"code": "",
"global": "vec3 repeat(vec3 p, vec3 r, float seed, float randomness) {\n\tvec3 a = (rand3(floor(mod((p.xy+0.5*r.xy)/r.xy, 1.0/r.xy)+vec2(seed)))-0.5)*6.28*randomness;\n\tp = mod(p+0.5*r,r)-0.5*r;\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": "Repeat",
"outputs": [
{
"sdf3d": "$in(repeat($uv, vec3(1.0/$rx, 1.0/$ry, 0.0), $seed, $r))",
"type": "sdf3d"
}
],
"parameters": [
{
"default": 4,
"label": "X",
"max": 32,
"min": 1,
"name": "rx",
"step": 1,
"type": "float"
},
{
"default": 4,
"label": "Y",
"max": 32,
"min": 1,
"name": "ry",
"step": 1,
"type": "float"
},
{
"default": 0.5,
"label": "R",
"max": 1,
"min": 0,
"name": "r",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}