VisualShaderNodeColorFunc.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShaderNodeColorFunc" inherits="VisualShaderNode" version="4.0">
  3. <brief_description>
  4. A [Color] function to be used within the visual shader graph.
  5. </brief_description>
  6. <description>
  7. Accept a [Color] to the input port and transform it according to [member function].
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <members>
  12. <member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeColorFunc.Function" default="0">
  13. A function to be applied to the input color. See [enum Function] for options.
  14. </member>
  15. </members>
  16. <constants>
  17. <constant name="FUNC_GRAYSCALE" value="0" enum="Function">
  18. Converts the color to grayscale using the following formula:
  19. [codeblock]
  20. vec3 c = input;
  21. float max1 = max(c.r, c.g);
  22. float max2 = max(max1, c.b);
  23. float max3 = max(max1, max2);
  24. return vec3(max3, max3, max3);
  25. [/codeblock]
  26. </constant>
  27. <constant name="FUNC_SEPIA" value="1" enum="Function">
  28. Applies sepia tone effect using the following formula:
  29. [codeblock]
  30. vec3 c = input;
  31. float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189);
  32. float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168);
  33. float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131);
  34. return vec3(r, g, b);
  35. [/codeblock]
  36. </constant>
  37. <constant name="FUNC_MAX" value="2" enum="Function">
  38. Represents the size of the [enum Function] enum.
  39. </constant>
  40. </constants>
  41. </class>