material-maker/addons/material_maker/nodes/supersample.mmg

76 lines
2.0 KiB
Plaintext

{
"name": "supersample",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"count": 2,
"size": 9,
"width": 1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "vec4(1.0, 1.0, 1.0, 1.0)",
"function": true,
"label": "",
"longdesc": "The input image",
"name": "in",
"shortdesc": "Input",
"type": "rgba"
}
],
"instance": "vec4 supersample_$(name)(vec2 uv, float size, int count, float width) {\n\tvec4 rv = vec4(0.0);\n\tvec2 step_size = vec2(width)/size/float(count);\n\tuv -= vec2(0.5)/size;\n\tfor (int x = 0; x < count; ++x) {\n\t\tfor (int y = 0; y < count; ++y) {\n\t\t\trv += $in(uv+(vec2(float(x), float(y))+vec2(0.5))*step_size);\n\t\t}\n\t}\n\treturn rv/float(count*count);\n}",
"longdesc": "A filter that samples sub-pixel details to make them visible",
"name": "Supersample",
"outputs": [
{
"longdesc": "Shows the supersampled image. Due to the performance cost of this node, it is recommended to connect a buffer directly to this output.",
"rgba": "supersample_$(name)($uv, $size, int($count), $width)",
"shortdesc": "Output",
"type": "rgba"
}
],
"parameters": [
{
"default": 10,
"first": 4,
"label": "Size",
"last": 12,
"longdesc": "The resolution of the output",
"name": "size",
"shortdesc": "Size",
"type": "size"
},
{
"control": "None",
"default": 2,
"label": "Count",
"longdesc": "The number of samples on each axis. High values will badly impact performances.",
"max": 5,
"min": 2,
"name": "count",
"shortdesc": "Count",
"step": 1,
"type": "float"
},
{
"control": "None",
"default": 1,
"label": "Width",
"longdesc": "The width of the sampled area. Setting this value higher than 1 will sample neighbouring pixels and antialias the result.",
"max": 2,
"min": 1,
"name": "width",
"shortdesc": "Width",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "Supersample"
},
"type": "shader"
}