2018-07-26 11:56:21 +02:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2021-03-23 13:40:34 +01:00
|
|
|
<class name="VisualShaderNodeColorOp" inherits="VisualShaderNode" version="3.3">
|
2018-07-26 11:56:21 +02:00
|
|
|
<brief_description>
|
2020-01-23 08:31:45 +01:00
|
|
|
A [Color] operator to be used within the visual shader graph.
|
2018-07-26 11:56:21 +02:00
|
|
|
</brief_description>
|
|
|
|
<description>
|
2020-01-23 08:31:45 +01:00
|
|
|
Applies [member operator] to two color inputs.
|
2018-07-26 11:56:21 +02:00
|
|
|
</description>
|
|
|
|
<tutorials>
|
|
|
|
</tutorials>
|
|
|
|
<methods>
|
|
|
|
</methods>
|
|
|
|
<members>
|
2019-06-29 12:38:01 +02:00
|
|
|
<member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeColorOp.Operator" default="0">
|
2020-01-23 08:31:45 +01:00
|
|
|
An operator to be applied to the inputs. See [enum Operator] for options.
|
2018-07-26 11:56:21 +02:00
|
|
|
</member>
|
|
|
|
</members>
|
|
|
|
<constants>
|
|
|
|
<constant name="OP_SCREEN" value="0" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a screen effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b);
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_DIFFERENCE" value="1" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a difference effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = abs(a - b);
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_DARKEN" value="2" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a darken effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = min(a, b);
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_LIGHTEN" value="3" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a lighten effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = max(a, b);
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_OVERLAY" value="4" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce an overlay effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_DODGE" value="5" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a dodge effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = a / (vec3(1.0) - b);
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_BURN" value="6" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a burn effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
result = vec3(1.0) - (vec3(1.0) - a) / b;
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_SOFT_LIGHT" value="7" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a soft light effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
<constant name="OP_HARD_LIGHT" value="8" enum="Operator">
|
2020-01-23 08:31:45 +01:00
|
|
|
Produce a hard light effect with the following formula:
|
|
|
|
[codeblock]
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[/codeblock]
|
2018-07-26 11:56:21 +02:00
|
|
|
</constant>
|
|
|
|
</constants>
|
|
|
|
</class>
|