mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
e919507f06
- Added signed distance functions 2D and 2D input/output types - Updated SDF2D nodes to used SDF2D inputs/outputs - Added preview code for SDF2D and SDF3D - Updates all SDF2D templates - Added basic SDF3D nodes
75 lines
1.5 KiB
Plaintext
75 lines
1.5 KiB
Plaintext
{
|
|
"name": "sdf3d_smoothboolean",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"bevel": 0,
|
|
"cx": 0,
|
|
"cy": 0,
|
|
"h": 0.08,
|
|
"k": 0.1,
|
|
"op": 0,
|
|
"r": 0.3,
|
|
"w": 0.28
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "float sdf3SmoothUnion(float d1, float d2, float k) {\n float h = clamp(0.5+0.5*(d2-d1)/k, 0.0, 1.0);\n return mix(d2, d1, h)-k*h*(1.0-h);\n}\n\nfloat sdf3SmoothSubtraction( float d1, float d2, float k ) {\n float h = clamp(0.5-0.5*(d2+d1)/k, 0.0, 1.0);\n return mix( d2, -d1, h )+k*h*(1.0-h);\n}\n\nfloat sdf3SmoothIntersection( float d1, float d2, float k ) {\n float h = clamp(0.5-0.5*(d2-d1)/k, 0.0, 1.0);\n return mix(d2, d1, h)+k*h*(1.0-h);\n}\n",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in1",
|
|
"type": "sdf3d"
|
|
},
|
|
{
|
|
"default": "0.0",
|
|
"label": "",
|
|
"name": "in2",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "sdSmoothBoolean",
|
|
"outputs": [
|
|
{
|
|
"sdf3d": "sdf3Smooth$op($in1($uv), $in2($uv), $k)",
|
|
"type": "sdf3d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "",
|
|
"name": "op",
|
|
"type": "enum",
|
|
"values": [
|
|
{
|
|
"name": "Union",
|
|
"value": "Union"
|
|
},
|
|
{
|
|
"name": "Subtraction",
|
|
"value": "Subtraction"
|
|
},
|
|
{
|
|
"name": "Intersection",
|
|
"value": "Intersection"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "k",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |