class_material.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Material.xml.
  6. .. _class_Material:
  7. Material
  8. ========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`BaseMaterial3D<class_BaseMaterial3D>`, :ref:`CanvasItemMaterial<class_CanvasItemMaterial>`, :ref:`FogMaterial<class_FogMaterial>`, :ref:`PanoramaSkyMaterial<class_PanoramaSkyMaterial>`, :ref:`ParticleProcessMaterial<class_ParticleProcessMaterial>`, :ref:`PhysicalSkyMaterial<class_PhysicalSkyMaterial>`, :ref:`PlaceholderMaterial<class_PlaceholderMaterial>`, :ref:`ProceduralSkyMaterial<class_ProceduralSkyMaterial>`, :ref:`ShaderMaterial<class_ShaderMaterial>`
  11. Virtual base class for applying visual properties to an object, such as color and roughness.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. **Material** is a base resource used for coloring and shading geometry. All materials inherit from it and almost all :ref:`VisualInstance3D<class_VisualInstance3D>` derived nodes carry a **Material**. A few flags and parameters are shared between all material types and are configured here.
  16. Importantly, you can inherit from **Material** to create your own custom material type in script or in GDExtension.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/2742>`__
  21. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +---------------------------------+-----------------------------------------------------------------+
  28. | :ref:`Material<class_Material>` | :ref:`next_pass<class_Material_property_next_pass>` |
  29. +---------------------------------+-----------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`render_priority<class_Material_property_render_priority>` |
  31. +---------------------------------+-----------------------------------------------------------------+
  32. .. rst-class:: classref-reftable-group
  33. Methods
  34. -------
  35. .. table::
  36. :widths: auto
  37. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`_can_do_next_pass<class_Material_private_method__can_do_next_pass>`\ (\ ) |virtual| |const| |
  39. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`_can_use_render_priority<class_Material_private_method__can_use_render_priority>`\ (\ ) |virtual| |const| |
  41. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Mode<enum_Shader_Mode>` | :ref:`_get_shader_mode<class_Material_private_method__get_shader_mode>`\ (\ ) |virtual| |const| |
  43. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  44. | :ref:`RID<class_RID>` | :ref:`_get_shader_rid<class_Material_private_method__get_shader_rid>`\ (\ ) |virtual| |const| |
  45. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Resource<class_Resource>` | :ref:`create_placeholder<class_Material_method_create_placeholder>`\ (\ ) |const| |
  47. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  48. | |void| | :ref:`inspect_native_shader_code<class_Material_method_inspect_native_shader_code>`\ (\ ) |
  49. +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
  50. .. rst-class:: classref-section-separator
  51. ----
  52. .. rst-class:: classref-descriptions-group
  53. Constants
  54. ---------
  55. .. _class_Material_constant_RENDER_PRIORITY_MAX:
  56. .. rst-class:: classref-constant
  57. **RENDER_PRIORITY_MAX** = ``127`` :ref:`🔗<class_Material_constant_RENDER_PRIORITY_MAX>`
  58. Maximum value for the :ref:`render_priority<class_Material_property_render_priority>` parameter.
  59. .. _class_Material_constant_RENDER_PRIORITY_MIN:
  60. .. rst-class:: classref-constant
  61. **RENDER_PRIORITY_MIN** = ``-128`` :ref:`🔗<class_Material_constant_RENDER_PRIORITY_MIN>`
  62. Minimum value for the :ref:`render_priority<class_Material_property_render_priority>` parameter.
  63. .. rst-class:: classref-section-separator
  64. ----
  65. .. rst-class:: classref-descriptions-group
  66. Property Descriptions
  67. ---------------------
  68. .. _class_Material_property_next_pass:
  69. .. rst-class:: classref-property
  70. :ref:`Material<class_Material>` **next_pass** :ref:`🔗<class_Material_property_next_pass>`
  71. .. rst-class:: classref-property-setget
  72. - |void| **set_next_pass**\ (\ value\: :ref:`Material<class_Material>`\ )
  73. - :ref:`Material<class_Material>` **get_next_pass**\ (\ )
  74. Sets the **Material** to be used for the next pass. This renders the object again using a different material.
  75. \ **Note:** :ref:`next_pass<class_Material_property_next_pass>` materials are not necessarily drawn immediately after the source **Material**. Draw order is determined by material properties, :ref:`render_priority<class_Material_property_render_priority>`, and distance to camera.
  76. \ **Note:** This only applies to :ref:`StandardMaterial3D<class_StandardMaterial3D>`\ s and :ref:`ShaderMaterial<class_ShaderMaterial>`\ s with type "Spatial".
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_Material_property_render_priority:
  80. .. rst-class:: classref-property
  81. :ref:`int<class_int>` **render_priority** :ref:`🔗<class_Material_property_render_priority>`
  82. .. rst-class:: classref-property-setget
  83. - |void| **set_render_priority**\ (\ value\: :ref:`int<class_int>`\ )
  84. - :ref:`int<class_int>` **get_render_priority**\ (\ )
  85. Sets the render priority for objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. In other words, all objects with :ref:`render_priority<class_Material_property_render_priority>` ``1`` will render before all objects with :ref:`render_priority<class_Material_property_render_priority>` ``0``.
  86. \ **Note:** This only applies to :ref:`StandardMaterial3D<class_StandardMaterial3D>`\ s and :ref:`ShaderMaterial<class_ShaderMaterial>`\ s with type "Spatial".
  87. \ **Note:** This will not impact how transparent objects are sorted relative to opaque objects or how dynamic meshes will be sorted relative to other opaque meshes. This is because all transparent objects are drawn after all opaque objects and all dynamic opaque meshes are drawn before other opaque meshes.
  88. .. rst-class:: classref-section-separator
  89. ----
  90. .. rst-class:: classref-descriptions-group
  91. Method Descriptions
  92. -------------------
  93. .. _class_Material_private_method__can_do_next_pass:
  94. .. rst-class:: classref-method
  95. :ref:`bool<class_bool>` **_can_do_next_pass**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__can_do_next_pass>`
  96. Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if :ref:`next_pass<class_Material_property_next_pass>` should be shown in the editor or not.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_Material_private_method__can_use_render_priority:
  100. .. rst-class:: classref-method
  101. :ref:`bool<class_bool>` **_can_use_render_priority**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__can_use_render_priority>`
  102. Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if :ref:`render_priority<class_Material_property_render_priority>` should be shown in the editor or not.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_Material_private_method__get_shader_mode:
  106. .. rst-class:: classref-method
  107. :ref:`Mode<enum_Shader_Mode>` **_get_shader_mode**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__get_shader_mode>`
  108. Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools.
  109. .. rst-class:: classref-item-separator
  110. ----
  111. .. _class_Material_private_method__get_shader_rid:
  112. .. rst-class:: classref-method
  113. :ref:`RID<class_RID>` **_get_shader_rid**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__get_shader_rid>`
  114. Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools. Used to access the RID of the **Material**'s :ref:`Shader<class_Shader>`.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_Material_method_create_placeholder:
  118. .. rst-class:: classref-method
  119. :ref:`Resource<class_Resource>` **create_placeholder**\ (\ ) |const| :ref:`🔗<class_Material_method_create_placeholder>`
  120. Creates a placeholder version of this resource (:ref:`PlaceholderMaterial<class_PlaceholderMaterial>`).
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_Material_method_inspect_native_shader_code:
  124. .. rst-class:: classref-method
  125. |void| **inspect_native_shader_code**\ (\ ) :ref:`🔗<class_Material_method_inspect_native_shader_code>`
  126. Only available when running in the editor. Opens a popup that visualizes the generated shader code, including all variants and internal shader code. See also :ref:`Shader.inspect_native_shader_code<class_Shader_method_inspect_native_shader_code>`.
  127. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  128. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  129. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  130. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  131. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  132. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  133. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  134. .. |void| replace:: :abbr:`void (No return value.)`