VisualShaderNodeColorFunc.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShaderNodeColorFunc" inherits="VisualShaderNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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. <methods>
  12. </methods>
  13. <members>
  14. <member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeColorFunc.Function" default="0">
  15. A function to be applied to the input color. See [enum Function] for options.
  16. </member>
  17. </members>
  18. <constants>
  19. <constant name="FUNC_GRAYSCALE" value="0" enum="Function">
  20. Converts the color to grayscale using the following formula:
  21. [codeblock]
  22. vec3 c = input;
  23. float max1 = max(c.r, c.g);
  24. float max2 = max(max1, c.b);
  25. float max3 = max(max1, max2);
  26. return vec3(max3, max3, max3);
  27. [/codeblock]
  28. </constant>
  29. <constant name="FUNC_SEPIA" value="1" enum="Function">
  30. Applies sepia tone effect using the following formula:
  31. [codeblock]
  32. vec3 c = input;
  33. float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189);
  34. float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168);
  35. float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131);
  36. return vec3(r, g, b);
  37. [/codeblock]
  38. </constant>
  39. </constants>
  40. </class>