mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
118 lines
2.4 KiB
Plaintext
118 lines
2.4 KiB
Plaintext
{
|
|
"name": "box",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"cx": 0.5,
|
|
"cy": 0.5,
|
|
"cz": 0.5,
|
|
"r": 0.5,
|
|
"rx": 0,
|
|
"ry": 0,
|
|
"rz": 0,
|
|
"sx": 0.25,
|
|
"sy": 0.25,
|
|
"sz": 0.25
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "float box(vec2 uv, vec3 center, vec3 rad, vec3 rot) {\n\tvec3 ro = vec3(uv, 1.0)-center;\n\tvec3 rd = vec3(0.0000001, 0.0000001, -1.0);\n\tmat3 r = mat3(vec3(1, 0, 0), vec3(0, cos(rot.x), -sin(rot.x)), vec3(0, sin(rot.x), cos(rot.x)));\n\tr *= mat3(vec3(cos(rot.y), 0, -sin(rot.y)), vec3(0, 1, 0), vec3(sin(rot.y), 0, cos(rot.y)));\n\tr *= mat3(vec3(cos(rot.z), -sin(rot.z), 0), vec3(sin(rot.z), cos(rot.z), 0), vec3(0, 0, 1));\n\tro = r * ro;\n\trd = r * rd;\n vec3 m = 1.0/rd;\n vec3 n = m*ro;\n vec3 k = abs(m)*rad;\n vec3 t1 = -n - k;\n vec3 t2 = -n + k;\n\n float tN = max(max(t1.x, t1.y), t1.z);\n float tF = min(min(t2.x, t2.y), t2.z);\n if(tN>tF || tF<0.0) return 1.0;\n return tN;\n}",
|
|
"inputs": [
|
|
|
|
],
|
|
"instance": "",
|
|
"name": "Box",
|
|
"outputs": [
|
|
{
|
|
"f": "1.0-box($uv, vec3($cx, $cy, $cz), vec3($sx, $sy, $sz), 0.01745329251*vec3($rx, $ry, $rz))",
|
|
"type": "f"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0.5,
|
|
"label": "Center X",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "cx",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0.5,
|
|
"label": "Center Y",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "cy",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Center Z",
|
|
"max": 0.5,
|
|
"min": -0.5,
|
|
"name": "cz",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"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,
|
|
"label": "Rot X",
|
|
"max": 180,
|
|
"min": -180,
|
|
"name": "rx",
|
|
"step": 0.1,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Rot Y",
|
|
"max": 180,
|
|
"min": -180,
|
|
"name": "ry",
|
|
"step": 0.1,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Rot Z",
|
|
"max": 180,
|
|
"min": -180,
|
|
"name": "rz",
|
|
"step": 0.1,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |