Dividi alfa

A volte, in special modo nel settore dello sviluppo dei giochi, gli artisti hanno necessità di lavorare separatamente col canale alfa della trama. Krita offre assistenza a questo tipo di lavoro con una speciale funzionalità chiamata Dividi alfa. Essa ti permette di dividere il canale alfa di un livello di disegno in una Maschere di trasparenza separata. L’artista può lavorare sulla maschera di trasparenza in un ambiente isolato e unirla di nuovo una volta terminato il lavoro.

Lavorare col canale alfa del livello

  1. Fai mouseright sul livello del disegno nell’area di aggancio Livelli.

  2. Scegli Dividi alfa ‣ Alfa nella maschera.

  3. Usa il tuo strumento di disegno preferito per disegnare la maschera di trasparenza; il nero disegna trasparenza (ci si vede attraverso), il bianco disegna opacità (visibile); i valori grigi disegnano semi-trasparenza.

  4. Se preferisci isolare il canale alfa, entra in modalità Isolata con mouseright + Isola livello (o la combinazione di tasti Alt + mouseleft).

  5. Quando hai terminato di modificare la maschera di trasparenza, fai clic col mouseright su di essa e seleziona Dividi alfa ‣ Scrivi come alfa.

Salvare una trama PNG e mantenere i valori dei colori in aree completamente trasparenti

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:

  1. mouseright sul livello nell’area di aggancio Livelli.

  2. Scegli Dividi alfa ‣ Alfa nella maschera.

  3. mouseright sulla maschera creata e selezione di Dividi alfa ‣ Salva l’unione….

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 Edit ‣ Clear 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 Split Alpha ‣ Alpha into Mask 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 Split Alpha ‣ Save Merged… action to properly save the result of this split alpha work. When exporting the result via File ‣ Export…, a compositing operation may (or may not) happen, clearing out the transparent areas.