Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Texture blit shaders

Texture blit shaders are used to define the behavior of blit calls on a DrawableTexture2D.

Texture blit shaders only have one processing function, the blit() function, which runs for every pixel of the source texture inside the rect given to blit_rect().

Vedi anche

See Using DrawableTextures for more information on how to use texture blit shaders as part of a DrawableTexture.

Modalità di rendering

Modalità di rendering

Descrizione

blend_disabled

Disable blending, values (including alpha) are written as-is. Default.

blend_mix

Mix blend mode (alpha is transparency).

blend_add

Modalità di fusione additiva.

blend_sub

Modalità di fusione sottrattiva.

blend_mul

Modalità di fusione moltiplicativa.

Nota

There is no premultiplied alpha blend mode for Texture blit shaders.

Variabili integrate

I valori marcati come in sono di sola lettura. I valori marcati come out sono scrivibili facoltativamente e non contengono necessariamente valori sensati. I valori marcati come inout forniscono un valore predefinito sensato e sono scrivibili facoltativamente. I campionatori non sono scrivibili, quindi non sono marcati.

Variabili integrate globali

Le variabili integrate globali sono disponibili ovunque, comprese le funzioni personalizzate.

Integrato

Descrizione

in float TIME

Tempo globale dall'avvio del motore, in secondi. Si ripete ogni 3.600 secondi (che si può cambiare con l'impostazione rollover). È influenzato da time_scale ma non dalla pausa. Se è necessaria una variabile TIME che non sia influenzata dalla scala temporale, aggiungere il proprio uniforme di shader globale e aggiornarlo a ogni frame.

in float PI

Una costante PI (3.141592). Il rapporto tra la circonferenza di un cerchio e il suo diametro, e il numero di radianti in mezzo giro.

in float TAU

A TAU constant (6.283185). An equivalent of PI * 2 and amount of radians in full turn.

in float E

An E constant (2.718281). Euler's number and a base of the natural logarithm.

Blit built-ins

Source textures

Texture blit shaders have up to 4 source textures bound as inputs. These can be accessed with a sampler2D using hint_blit_source0, hint_blit_source1, hint_blit_source2, and hint_blit_source3.

Integrato

Descrizione

in vec4 FRAGCOORD

Coordinate of pixel center. In screen space. xy specifies position in viewport. Upper-left of the viewport is the origin, (0.0, 0.0).

in vec2 UV

UV from the vertex() function. This is set to sample all of a source texture.

in vec4 MODULATE

MODULATE color passed in by RenderingServer API.

out vec4 COLOR0

Output color to blended with the DrawableTexture target. Initialized to (0.0, 0.0, 0.0, 0.0).

out vec4 COLOR1

Output color to blended with an extra DrawableTexture target. Initialized to (0.0, 0.0, 0.0, 0.0).

out vec4 COLOR2

Output color to blended with an extra DrawableTexture target. Initialized to (0.0, 0.0, 0.0, 0.0).

out vec4 COLOR3

Output color to blended with an extra DrawableTexture target. Initialized to (0.0, 0.0, 0.0, 0.0).