class_shadermaterial.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/ShaderMaterial.xml.
  6. .. _class_ShaderMaterial:
  7. ShaderMaterial
  8. ==============
  9. **Inherits:** :ref:`Material<class_Material>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A material that uses a custom :ref:`Shader<class_Shader>` program.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A material that uses a custom :ref:`Shader<class_Shader>` program to render either items to screen or process particles. You can create multiple materials for the same shader but configure different values for the uniforms defined in the shader.
  15. \ **Note:** Due to a renderer limitation, emissive **ShaderMaterial**\ s cannot emit light when used in a :ref:`GIProbe<class_GIProbe>`. Only emissive :ref:`SpatialMaterial<class_SpatialMaterial>`\ s can emit light in a :ref:`GIProbe<class_GIProbe>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`../tutorials/shaders/index`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------+-----------------------------------------------------+
  26. | :ref:`Shader<class_Shader>` | :ref:`shader<class_ShaderMaterial_property_shader>` |
  27. +-----------------------------+-----------------------------------------------------+
  28. .. rst-class:: classref-reftable-group
  29. Methods
  30. -------
  31. .. table::
  32. :widths: auto
  33. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Variant<class_Variant>` | :ref:`get_shader_param<class_ShaderMaterial_method_get_shader_param>` **(** :ref:`String<class_String>` param **)** |const| |
  35. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`property_can_revert<class_ShaderMaterial_method_property_can_revert>` **(** :ref:`String<class_String>` name **)** |
  37. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Variant<class_Variant>` | :ref:`property_get_revert<class_ShaderMaterial_method_property_get_revert>` **(** :ref:`String<class_String>` name **)** |
  39. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_shader_param<class_ShaderMaterial_method_set_shader_param>` **(** :ref:`String<class_String>` param, :ref:`Variant<class_Variant>` value **)** |
  41. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Property Descriptions
  46. ---------------------
  47. .. _class_ShaderMaterial_property_shader:
  48. .. rst-class:: classref-property
  49. :ref:`Shader<class_Shader>` **shader**
  50. .. rst-class:: classref-property-setget
  51. - void **set_shader** **(** :ref:`Shader<class_Shader>` value **)**
  52. - :ref:`Shader<class_Shader>` **get_shader** **(** **)**
  53. The :ref:`Shader<class_Shader>` program used to render this material.
  54. .. rst-class:: classref-section-separator
  55. ----
  56. .. rst-class:: classref-descriptions-group
  57. Method Descriptions
  58. -------------------
  59. .. _class_ShaderMaterial_method_get_shader_param:
  60. .. rst-class:: classref-method
  61. :ref:`Variant<class_Variant>` **get_shader_param** **(** :ref:`String<class_String>` param **)** |const|
  62. Returns the current value set for this material of a uniform in the shader.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_ShaderMaterial_method_property_can_revert:
  66. .. rst-class:: classref-method
  67. :ref:`bool<class_bool>` **property_can_revert** **(** :ref:`String<class_String>` name **)**
  68. Returns ``true`` if the property identified by ``name`` can be reverted to a default value.
  69. .. rst-class:: classref-item-separator
  70. ----
  71. .. _class_ShaderMaterial_method_property_get_revert:
  72. .. rst-class:: classref-method
  73. :ref:`Variant<class_Variant>` **property_get_revert** **(** :ref:`String<class_String>` name **)**
  74. Returns the default value of the material property with given ``name``.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_ShaderMaterial_method_set_shader_param:
  78. .. rst-class:: classref-method
  79. void **set_shader_param** **(** :ref:`String<class_String>` param, :ref:`Variant<class_Variant>` value **)**
  80. Changes the value set for this material of a uniform in the shader.
  81. \ **Note:** ``param`` must match the name of the uniform in the code exactly.
  82. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  83. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  84. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  85. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`