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.

VisualShaderNodeColorOp

繼承: VisualShaderNode < Resource < RefCounted < Object

在視覺化著色器圖中使用的 Color 運算子。

說明

operator 套用於兩個顏色輸入。

屬性

Operator

operator

0


列舉

enum Operator: 🔗

Operator OP_SCREEN = 0

用以下公式產生螢幕效果。

result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b);

Operator OP_DIFFERENCE = 1

用以下公式產生差異效果。

result = abs(a - b);

Operator OP_DARKEN = 2

用以下公式產生變暗效果。

result = min(a, b);

Operator OP_LIGHTEN = 3

用以下公式產生減淡效果。

result = max(a, b);

Operator OP_OVERLAY = 4

用以下公式產生疊加效果。

for (int i = 0; i < 3; i++) {
    float base = a[i];
    float blend = b[i];
    if (base < 0.5) {
        result[i] = 2.0 * base * blend;
    } else {
        result[i] = 1.0 - 2.0 * (1.0 - blend) * (1.0 - base);
    }
}

Operator OP_DODGE = 5

用以下公式產生閃避效果。

result = a / (vec3(1.0) - b);

Operator OP_BURN = 6

用以下公式產生燃燒效果。

result = vec3(1.0) - (vec3(1.0) - a) / b;

Operator OP_SOFT_LIGHT = 7

用以下公式產生柔光效果。

for (int i = 0; i < 3; i++) {
    float base = a[i];
    float blend = b[i];
    if (base < 0.5) {
        result[i] = base * (blend + 0.5);
    } else {
        result[i] = 1.0 - (1.0 - base) * (1.0 - (blend - 0.5));
    }
}

Operator OP_HARD_LIGHT = 8

用以下公式產生硬光效果。

for (int i = 0; i < 3; i++) {
    float base = a[i];
    float blend = b[i];
    if (base < 0.5) {
        result[i] = base * (2.0 * blend);
    } else {
        result[i] = 1.0 - (1.0 - base) * (1.0 - 2.0 * (blend - 0.5));
    }
}

Operator OP_MAX = 9

代表 Operator 列舉的大小。


屬性說明

Operator operator = 0 🔗

An operator to be applied to the inputs.