mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
68 lines
1.2 KiB
Plaintext
68 lines
1.2 KiB
Plaintext
|
{
|
||
|
"name": "sdrhombus",
|
||
|
"node_position": {
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
"parameters": {
|
||
|
"cx": 0,
|
||
|
"cy": 0,
|
||
|
"h": 0.2,
|
||
|
"r": 0.3,
|
||
|
"w": 0.3
|
||
|
},
|
||
|
"shader_model": {
|
||
|
"code": "",
|
||
|
"global": "float sdr_ndot(vec2 a, vec2 b) { return a.x*b.x - a.y*b.y; }\nfloat sdRhombus(in vec2 p, in vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*sdr_ndot(q,b)+sdr_ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}",
|
||
|
"inputs": [
|
||
|
|
||
|
],
|
||
|
"instance": "",
|
||
|
"name": "sdRhombus",
|
||
|
"outputs": [
|
||
|
{
|
||
|
"f": "sdRhombus($uv-0.5*vec2($cx+1.0, $cy+1.0), vec2($w, $h))",
|
||
|
"type": "f"
|
||
|
}
|
||
|
],
|
||
|
"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"
|
||
|
}
|