From ce43c922083341aff6eb8bc017b36f61ec01f42f Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Thu, 23 Jan 2020 10:31:45 +0300 Subject: Docs for some nodes in visual shader Fix typo in `VisualShaderNodeCompare.ComparisonType` name. --- doc/classes/VisualShaderNode.xml | 6 +++ doc/classes/VisualShaderNodeBooleanConstant.xml | 4 ++ doc/classes/VisualShaderNodeBooleanUniform.xml | 2 + doc/classes/VisualShaderNodeColorConstant.xml | 4 ++ doc/classes/VisualShaderNodeColorFunc.xml | 19 ++++++++ doc/classes/VisualShaderNodeColorOp.xml | 63 +++++++++++++++++++++++++ doc/classes/VisualShaderNodeColorUniform.xml | 2 + doc/classes/VisualShaderNodeCompare.xml | 27 +++++++++-- 8 files changed, 122 insertions(+), 5 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/VisualShaderNode.xml b/doc/classes/VisualShaderNode.xml index 9f7e4573ff..185c5dab90 100644 --- a/doc/classes/VisualShaderNode.xml +++ b/doc/classes/VisualShaderNode.xml @@ -11,6 +11,7 @@ + Returns an [Array] containing default values for all of the input ports of the node in the form [code][index0, value0, index1, value1, ...][/code]. @@ -19,6 +20,7 @@ + Returns the default value of the input [code]port[/code]. @@ -27,6 +29,7 @@ + Sets the default input ports values using an [Array] of the form [code][index0, value0, index1, value1, ...][/code]. For example: [code][0, Vector3(0, 0, 0), 1, Vector3(0, 0, 0)][/code]. @@ -37,16 +40,19 @@ + Sets the default value for the selected input [code]port[/code]. + Sets the output port index which will be showed for preview. If set to [code]-1[/code] no port will be open for preview. + Emitted when the node requests an editor refresh. Currently called only in setter of [member VisualShaderNodeTexture.source], [VisualShaderNodeTexture], and [VisualShaderNodeCubeMap] (and their derivatives). diff --git a/doc/classes/VisualShaderNodeBooleanConstant.xml b/doc/classes/VisualShaderNodeBooleanConstant.xml index b46905cfea..aba2f63961 100644 --- a/doc/classes/VisualShaderNodeBooleanConstant.xml +++ b/doc/classes/VisualShaderNodeBooleanConstant.xml @@ -1,8 +1,11 @@ + A boolean constant to be used within the visual shader graph. + Has only one output port and no inputs. + Translated to [code]bool[/code] in the shader language. @@ -10,6 +13,7 @@ + A boolean constant which represents a state of this node. diff --git a/doc/classes/VisualShaderNodeBooleanUniform.xml b/doc/classes/VisualShaderNodeBooleanUniform.xml index 518c7ba3b8..f00f2031c7 100644 --- a/doc/classes/VisualShaderNodeBooleanUniform.xml +++ b/doc/classes/VisualShaderNodeBooleanUniform.xml @@ -1,8 +1,10 @@ + A boolean uniform to be used within the visual shader graph. + Translated to [code]uniform bool[/code] in the shader language. diff --git a/doc/classes/VisualShaderNodeColorConstant.xml b/doc/classes/VisualShaderNodeColorConstant.xml index 282966a9ca..333bfccf99 100644 --- a/doc/classes/VisualShaderNodeColorConstant.xml +++ b/doc/classes/VisualShaderNodeColorConstant.xml @@ -1,8 +1,11 @@ + A [Color] constant to be used within the visual shader graph. + Has two output ports representing RGB and alpha channels of [Color]. + Translated to [code]vec3 rgb[/code] and [code]float alpha[/code] in the shader language. @@ -10,6 +13,7 @@ + A [Color] constant which represents a state of this node. diff --git a/doc/classes/VisualShaderNodeColorFunc.xml b/doc/classes/VisualShaderNodeColorFunc.xml index b37a669ee9..9e8e13245b 100644 --- a/doc/classes/VisualShaderNodeColorFunc.xml +++ b/doc/classes/VisualShaderNodeColorFunc.xml @@ -1,8 +1,10 @@ + A [Color] function to be used within the visual shader graph. + Accept a [Color] to the input port and transform it according to [member function]. @@ -10,12 +12,29 @@ + A function to be applied to the input color. See [enum Function] for options. + Converts the color to grayscale using the following formula: + [codeblock] + vec3 c = input; + float max1 = max(c.r, c.g); + float max2 = max(max1, c.b); + float max3 = max(max1, max2); + return vec3(max3, max3, max3); + [/codeblock] + Applies sepia tone effect using the following formula: + [codeblock] + vec3 c = input; + float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189); + float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168); + float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131); + return vec3(r, g, b); + [/codeblock] diff --git a/doc/classes/VisualShaderNodeColorOp.xml b/doc/classes/VisualShaderNodeColorOp.xml index 77c5361f4d..414de2ed5a 100644 --- a/doc/classes/VisualShaderNodeColorOp.xml +++ b/doc/classes/VisualShaderNodeColorOp.xml @@ -1,8 +1,10 @@ + A [Color] operator to be used within the visual shader graph. + Applies [member operator] to two color inputs. @@ -10,26 +12,87 @@ + An operator to be applied to the inputs. See [enum Operator] for options. + Produce a screen effect with the following formula: + [codeblock] + result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b); + [/codeblock] + Produce a difference effect with the following formula: + [codeblock] + result = abs(a - b); + [/codeblock] + Produce a darken effect with the following formula: + [codeblock] + result = min(a, b); + [/codeblock] + Produce a lighten effect with the following formula: + [codeblock] + result = max(a, b); + [/codeblock] + 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] + Produce a dodge effect with the following formula: + [codeblock] + result = a / (vec3(1.0) - b); + [/codeblock] + Produce a burn effect with the following formula: + [codeblock] + result = vec3(1.0) - (vec3(1.0) - a) / b; + [/codeblock] + 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] + 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] diff --git a/doc/classes/VisualShaderNodeColorUniform.xml b/doc/classes/VisualShaderNodeColorUniform.xml index ec61729782..7d07aa0051 100644 --- a/doc/classes/VisualShaderNodeColorUniform.xml +++ b/doc/classes/VisualShaderNodeColorUniform.xml @@ -1,8 +1,10 @@ + A [Color] uniform to be used within the visual shader graph. + Translated to [code]uniform vec4[/code] in the shader language. diff --git a/doc/classes/VisualShaderNodeCompare.xml b/doc/classes/VisualShaderNodeCompare.xml index 7edad5294d..3eaa1399b1 100644 --- a/doc/classes/VisualShaderNodeCompare.xml +++ b/doc/classes/VisualShaderNodeCompare.xml @@ -1,8 +1,10 @@ + A comparison function for common types within the visual shader graph. + Compares [code]a[/code] and [code]b[/code] of [member type] by [member function]. Returns a boolean scalar. Translates to [code]if[/code] instruction in shader code. @@ -10,36 +12,51 @@ + Extra condition which is applied if [member type] is set to [constant CTYPE_VECTOR]. + A comparison function. See [enum Function] for options. - + + The type to be used in the comparison. See [enum ComparisonType] for options. - + + A floating-point scalar. - + + A 3D vector type. - + + A boolean type. - + + A transform ([code]mat4[/code]) type. + Comparison for equality ([code]a == b[/code]). + Comparison for inequality ([code]a != b[/code]). + Comparison for greater than ([code]a > b[/code]). Cannot be used if [member type] set to [constant CTYPE_BOOLEAN] or [constant CTYPE_TRANSFORM]. + Comparison for greater than or equal ([code]a >= b[/code]). Cannot be used if [member type] set to [constant CTYPE_BOOLEAN] or [constant CTYPE_TRANSFORM]. + Comparison for less than ([code]a < b[/code]). Cannot be used if [member type] set to [constant CTYPE_BOOLEAN] or [constant CTYPE_TRANSFORM]. + Comparison for less than or equal ([code]a < b[/code]). Cannot be used if [member type] set to [constant CTYPE_BOOLEAN] or [constant CTYPE_TRANSFORM]. + The result will be true if all of component in vector satisfy the comparison condition. + The result will be true if any of component in vector satisfy the comparison condition. -- cgit v1.2.3