VisualShaderNodeColorOp¶
Inherits: VisualShaderNode < Resource < Reference < Object
在可视化着色器图中使用的Color运算符。
描述¶
将 operator 应用于两个颜色输入。
属性¶
|
枚举¶
enum Operator:
OP_SCREEN = 0 --- 用以下公式产生屏幕效果。
result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b);
OP_DIFFERENCE = 1 --- 用下面的公式产生差异效果。
result = abs(a - b);
OP_DARKEN = 2 --- 用以下公式产生变暗的效果。
result = min(a, b);
OP_LIGHTEN = 3 --- 用以下公式产生减淡效果。
result = max(a, b);
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);
}
}
OP_DODGE = 5 --- 用以下公式产生闪避效果。
result = a / (vec3(1.0) - b);
OP_BURN = 6 --- 用以下公式产生燃烧效果。
result = vec3(1.0) - (vec3(1.0) - a) / b;
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));
}
}
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 operator
Default |
|
Setter |
set_operator(value) |
Getter |
get_operator() |
要应用于输入的运算符。参阅Operator的选项。