Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions addons/material_maker/nodes/alpha_association.mmg
Original file line number Diff line number Diff line change
@@ -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"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions material_maker/doc/node_filter_alpha_association.rst
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions material_maker/doc/nodes_filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions material_maker/library/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down