拆分透明度通道到蒙版¶
有时候画师需要把透明度通道和材质分开处理,这在游戏开发场景尤为常见。为了辅助这一需求,Krita 准备了 功能。此功能可以把一个颜料图层的透明度通道拆分成一个独立的 透明度蒙版 ,画师可以在单纯的环境下处理该透明度蒙版,完成编辑后再合并回去。
如何拆分和编辑透明度通道¶
在图层面板中右键点击
颜料图层。选择 。
可以选用任意绘画工具在该透明度蒙版上进行绘制。黑色代表透明,白色代表不透明 (可见)。灰色按照深浅代表不同的半透明状态。
如果需要只显示拆分后的透明度通道,右键点击
该蒙版并选择 (也可以使用 Alt + 左键点击
该蒙版)。完成编辑该透明度蒙版后,右键点击
它并选择 。
如何在保存 PNG 材质时保留完全透明区域的颜色信息¶
Normally, when saving an image to a file, all fully transparent areas of the image are filled with black color. It happens because when compositing the layers of the image, Krita drop color data of fully transparent pixels for efficiency reason. To avoid this of color data loss you can either avoid compositing of the image i.e. limit image to only one layer without any masks or effects, or use the following method:
在图层面板中右键点击
颜料图层。选择 。
右键点击
创建的蒙版并选择 。
Color channel values in transparent areas¶
Krita treats all color channel values in fully transparent pixels as undefined. Effectively, it means that Krita will try to skip writing to (or reading from) a fully transparent pixel, unless it is really needed or explicitly requested. That is done for optimization purposes and allows Krita to speed up compositing the image by a lot.
Example 1: erasing pixels on the image¶
When erasing pixels with an eraser brush or when clearing a selection with action, the color data is not actually cleared. It is only the alpha channel that is zeroed, but color channels are kept intact. You can see it yourself if you try to apply on a layer after erasing with an eraser brush on it.
To actually clear the color channels of transparent areas you need to apply a Reset Transparent Filter on the image. It will zero-out all color channels of fully transparent pixels.
Krita also has a special Propagate Colors Filter. It fills the fully transparent areas with neighboring colors instead of just zeroing them out, which might be useful in some workflows.
Example 2: compositing layers with color data inside fully transparent areas¶
If you have multiple layers, which have any color data inside their fully transparent areas, the result of their merge will not include this color data. The resulting pixels will be just zeroed out. Obviously, you cannot blend two pixels with zero alpha, because you would have to divide by zero for that.
For most workflows it just means that you should use action to properly save the result of this split alpha work. When exporting the result via , a compositing operation may (or may not) happen, clearing out the transparent areas.