class_visualshadernodecolorfunc.rst 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisualShaderNodeColorFunc.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisualShaderNodeColorFunc:
  6. VisualShaderNodeColorFunc
  7. =========================
  8. **Inherits:** :ref:`VisualShaderNode<class_VisualShaderNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. A :ref:`Color<class_Color>` function to be used within the visual shader graph.
  10. Description
  11. -----------
  12. Accept a :ref:`Color<class_Color>` to the input port and transform it according to :ref:`function<class_VisualShaderNodeColorFunc_property_function>`.
  13. Properties
  14. ----------
  15. +----------------------------------------------------------+--------------------------------------------------------------------+-------+
  16. | :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` | :ref:`function<class_VisualShaderNodeColorFunc_property_function>` | ``0`` |
  17. +----------------------------------------------------------+--------------------------------------------------------------------+-------+
  18. Enumerations
  19. ------------
  20. .. _enum_VisualShaderNodeColorFunc_Function:
  21. .. _class_VisualShaderNodeColorFunc_constant_FUNC_GRAYSCALE:
  22. .. _class_VisualShaderNodeColorFunc_constant_FUNC_SEPIA:
  23. enum **Function**:
  24. - **FUNC_GRAYSCALE** = **0** --- Converts the color to grayscale using the following formula:
  25. ::
  26. vec3 c = input;
  27. float max1 = max(c.r, c.g);
  28. float max2 = max(max1, c.b);
  29. float max3 = max(max1, max2);
  30. return vec3(max3, max3, max3);
  31. - **FUNC_SEPIA** = **1** --- Applies sepia tone effect using the following formula:
  32. ::
  33. vec3 c = input;
  34. float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189);
  35. float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168);
  36. float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131);
  37. return vec3(r, g, b);
  38. Property Descriptions
  39. ---------------------
  40. .. _class_VisualShaderNodeColorFunc_property_function:
  41. - :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` **function**
  42. +-----------+---------------------+
  43. | *Default* | ``0`` |
  44. +-----------+---------------------+
  45. | *Setter* | set_function(value) |
  46. +-----------+---------------------+
  47. | *Getter* | get_function() |
  48. +-----------+---------------------+
  49. A function to be applied to the input color. See :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` for options.
  50. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  51. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  52. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`