diff --git a/addons/material_maker/nodes/alpha_association.mmg b/addons/material_maker/nodes/alpha_association.mmg new file mode 100644 index 000000000..47f979dc9 --- /dev/null +++ b/addons/material_maker/nodes/alpha_association.mmg @@ -0,0 +1,59 @@ +{ + "generic_size": 1, + "name": "alpha_association", + "node_position": { + "x": 0, + "y": 0 + }, + "parameters": { + "mode": 1.0 + }, + "seed_int": 0, + "shader_model": { + "code": "", + "global": "", + "inputs": [ + { + "default": "vec4(0.0, 0.0, 0.0, 1.0)", + "label": "", + "longdesc": "The image to be converted", + "name": "in#", + "shortdesc": "Input#", + "type": "rgba" + } + ], + "instance": "", + "longdesc": "Converts an input image from straight to premultiplied alpha and vice versa", + "name": "Alpha Association", + "outputs": [ + { + "longdesc": "The converted image", + "rgba": "vec4($in#($uv).rgb $mode $in#($uv).a, $in#($uv).a)", + "shortdesc": "Output#", + "type": "rgba" + } + ], + "parameters": [ + { + "default": 0.0, + "label": "", + "name": "mode", + "shortdesc": "Mode", + "longdesc": "Controls whether the node converts from straight to premultiplied or from premultiplied to straight", + "type": "enum", + "values": [ + { + "name": "Straight to Premultiplied", + "value": "*" + }, + { + "name": "Premultiplied to Straight", + "value": "/" + } + ] + } + ], + "shortdesc": "Alpha Association Conversion" + }, + "type": "shader" +} diff --git a/material_maker/doc/images/node_filter_alpha_association.png b/material_maker/doc/images/node_filter_alpha_association.png new file mode 100644 index 000000000..99502d952 Binary files /dev/null and b/material_maker/doc/images/node_filter_alpha_association.png differ diff --git a/material_maker/doc/node_filter_alpha_association.rst b/material_maker/doc/node_filter_alpha_association.rst new file mode 100644 index 000000000..33fff1c28 --- /dev/null +++ b/material_maker/doc/node_filter_alpha_association.rst @@ -0,0 +1,24 @@ +Alpha Association node +~~~~~~~~~~~~~~~~~~~~~~ + +The **Alpha Association** node is variadic and converts the input images' alpha association +from straight to premultiplied and vice versa. The alpha channel remains untouched. + +.. image:: images/node_filter_alpha_association.png + :align: center + +Inputs +++++++ + +The **Alpha Association** node requires an RGBA input texture. + +Outputs ++++++++ + +The **Alpha Association** node provides a single RGBA texture. + +Parameters +++++++++++ + +The **Alpha Association** node has a single **Mode** parameter to select between +converting from straight to premultiplied and from premultiplied to straight. diff --git a/material_maker/doc/nodes_filter.rst b/material_maker/doc/nodes_filter.rst index ec9756d6d..e7e098689 100644 --- a/material_maker/doc/nodes_filter.rst +++ b/material_maker/doc/nodes_filter.rst @@ -68,3 +68,4 @@ The filter nodes accept one or several inputs and generate one or several images node_filter_classic_kuwahara node_filter_generalized_kuwahara node_filter_symmetric_nearest_neighbor + node_filter_alpha_association diff --git a/material_maker/library/base.json b/material_maker/library/base.json index 26ef2aba9..318dff86b 100644 --- a/material_maker/library/base.json +++ b/material_maker/library/base.json @@ -7962,6 +7962,15 @@ "tree_item": "3D/SDF/Shapes/Octahedron", "type": "sdf3d_octahedron" }, + { + "display_name": "Alpha Association", + "name": "alpha_association", + "parameters": { + "mode": 0.0 + }, + "tree_item": "Filter/Alpha Association", + "type": "alpha_association" + }, { "display_name": "Inverse Circle Map", "icon_data": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAArlJREFUeJztmj1LI3scRs/e+DJYJDLBtyZKQCIWqcRSG1sLK7/OfhQRLBS7TNRC0FiICIIMKMYhasbGiDMYFTKi42yzG272uly3eor8DwQMPM7vcEiRIt+SJEnoYv5RC6gxAdQCakwAtYAaE0AtoMYEUAuoMQHUAmpMALWAGhNALaDGBFALqDEB1AJqTAC1gBoTQC2gxgRQC6gxAdQCaro+QM+/34RhiO/7vL6+kslkmJycJJVKffqPvu/TaDQAGBkZIZfLfbqL4xjP82g2m/T395PL5bBt+9Ot4n47wPn5OcfHx9TrdaIoIpPJUCgUmJubI5vNdjy0Uqngui53d3cAjI6OUiwWmZ+f79gFQcDBwQHVapVms4llWYyPjzM7O8v09HTHVnW/B6BarVIqlTg6OuLm5oYoihgcHGRqaoqnpyeWl5exLAuA3d1ddnZ2OD097RCo1+u8vb2xsLAAQBRFOI7D/v4+FxcXPD4+YlkWExMTNBoNUqkUhUIB9f2eVqtFuVzGcRwODw/5+PhoF/Q8j5eXF9LpNEtLS7iuS7lcZmtri8vLy/bu7OyM29tb4jhmeHiYYrHI9vY2juOwt7dHEATtreu6PDw80Nvb2/7YKu+nZmZmvq+trVGpVPj9txKtVourqysGBgYoFAo4jsP6+jqe5/E7QRAQBAHpdJqhoSFWV1fZ3Nzk+fm5Y5ckCb7vE8cx2WyWWq2G8n7Ktu3vGxsb/3ngL97f37m/v2dsbIxSqcTJyckft2EYEscxfX19rKysEIbhH7fX19fYtk2tVkN5n3w+nwD/+1pcXPzS7m+2+Xw+Ud/nqw+1LOvLAn+zVd//9vOPrqXrvwmaAGoBNSaAWkCNCaAWUGMCqAXUmABqATUmgFpAjQmgFlBjAqgF1JgAagE1JoBaQI0JoBZQYwKoBdR0fYAftHRSm0MKpOEAAAAASUVORK5CYII=",