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.
Checking the stable version of the documentation...
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().
也參考
See Using DrawableTextures for more information on how to use texture blit shaders as part of a DrawableTexture.
算繪模式
算繪模式 |
說明 |
|---|---|
blend_disabled |
Disable blending, values (including alpha) are written as-is. Default. |
blend_mix |
Mix blend mode (alpha is transparency). |
blend_add |
加法混合模式。 |
blend_sub |
減法混合模式。 |
blend_mul |
乘法混合模式。 |
備註
There is no premultiplied alpha blend mode for Texture blit shaders.
內建變數
標記為 in 的值為唯讀。標記為 out 的值可以選擇寫入,且不一定包含合理的預設值。標記為 inout 的值則有預設值,可以選擇寫入。取樣器(sampler)無法寫入,因此未標註。
全域內建變數
全域內建變數可於任何地方使用,包括自訂函式中。
內建變數 |
說明 |
|---|---|
in float TIME |
Global time since the engine has started, in seconds. It repeats after every |
in float PI |
A |
in float TAU |
A |
in float E |
An |
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.
內建變數 |
說明 |
|---|---|
in vec4 FRAGCOORD |
Coordinate of pixel center. In screen space. |
in vec2 UV |
UV from the |
in vec4 MODULATE |
|
out vec4 COLOR0 |
Output color to blended with the DrawableTexture target.
Initialized to |
out vec4 COLOR1 |
Output color to blended with an extra DrawableTexture target.
Initialized to |
out vec4 COLOR2 |
Output color to blended with an extra DrawableTexture target.
Initialized to |
out vec4 COLOR3 |
Output color to blended with an extra DrawableTexture target.
Initialized to |