VisualShaderNodeColorOp.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShaderNodeColorOp" inherits="VisualShaderNode" version="3.2">
  3. <brief_description>
  4. A [Color] operator to be used within the visual shader graph.
  5. </brief_description>
  6. <description>
  7. Applies [member operator] to two color inputs.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. </methods>
  13. <members>
  14. <member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeColorOp.Operator" default="0">
  15. An operator to be applied to the inputs. See [enum Operator] for options.
  16. </member>
  17. </members>
  18. <constants>
  19. <constant name="OP_SCREEN" value="0" enum="Operator">
  20. Produce a screen effect with the following formula:
  21. [codeblock]
  22. result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b);
  23. [/codeblock]
  24. </constant>
  25. <constant name="OP_DIFFERENCE" value="1" enum="Operator">
  26. Produce a difference effect with the following formula:
  27. [codeblock]
  28. result = abs(a - b);
  29. [/codeblock]
  30. </constant>
  31. <constant name="OP_DARKEN" value="2" enum="Operator">
  32. Produce a darken effect with the following formula:
  33. [codeblock]
  34. result = min(a, b);
  35. [/codeblock]
  36. </constant>
  37. <constant name="OP_LIGHTEN" value="3" enum="Operator">
  38. Produce a lighten effect with the following formula:
  39. [codeblock]
  40. result = max(a, b);
  41. [/codeblock]
  42. </constant>
  43. <constant name="OP_OVERLAY" value="4" enum="Operator">
  44. Produce an overlay effect with the following formula:
  45. [codeblock]
  46. for (int i = 0; i &lt; 3; i++) {
  47. float base = a[i];
  48. float blend = b[i];
  49. if (base &lt; 0.5) {
  50. result[i] = 2.0 * base * blend;
  51. } else {
  52. result[i] = 1.0 - 2.0 * (1.0 - blend) * (1.0 - base);
  53. }
  54. }
  55. [/codeblock]
  56. </constant>
  57. <constant name="OP_DODGE" value="5" enum="Operator">
  58. Produce a dodge effect with the following formula:
  59. [codeblock]
  60. result = a / (vec3(1.0) - b);
  61. [/codeblock]
  62. </constant>
  63. <constant name="OP_BURN" value="6" enum="Operator">
  64. Produce a burn effect with the following formula:
  65. [codeblock]
  66. result = vec3(1.0) - (vec3(1.0) - a) / b;
  67. [/codeblock]
  68. </constant>
  69. <constant name="OP_SOFT_LIGHT" value="7" enum="Operator">
  70. Produce a soft light effect with the following formula:
  71. [codeblock]
  72. for (int i = 0; i &lt; 3; i++) {
  73. float base = a[i];
  74. float blend = b[i];
  75. if (base &lt; 0.5) {
  76. result[i] = base * (blend + 0.5);
  77. } else {
  78. result[i] = 1.0 - (1.0 - base) * (1.0 - (blend - 0.5));
  79. }
  80. }
  81. [/codeblock]
  82. </constant>
  83. <constant name="OP_HARD_LIGHT" value="8" enum="Operator">
  84. Produce a hard light effect with the following formula:
  85. [codeblock]
  86. for (int i = 0; i &lt; 3; i++) {
  87. float base = a[i];
  88. float blend = b[i];
  89. if (base &lt; 0.5) {
  90. result[i] = base * (2.0 * blend);
  91. } else {
  92. result[i] = 1.0 - (1.0 - base) * (1.0 - 2.0 * (blend - 0.5));
  93. }
  94. }
  95. [/codeblock]
  96. </constant>
  97. </constants>
  98. </class>