123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Material.xml.
- .. _class_Material:
- Material
- ========
- **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- **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>`
- Virtual base class for applying visual properties to an object, such as color and roughness.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- **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.
- Importantly, you can inherit from **Material** to create your own custom material type in script or in GDExtension.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/2742>`__
- - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------+-----------------------------------------------------------------+
- | :ref:`Material<class_Material>` | :ref:`next_pass<class_Material_property_next_pass>` |
- +---------------------------------+-----------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`render_priority<class_Material_property_render_priority>` |
- +---------------------------------+-----------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`_can_do_next_pass<class_Material_private_method__can_do_next_pass>`\ (\ ) |virtual| |const| |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`_can_use_render_priority<class_Material_private_method__can_use_render_priority>`\ (\ ) |virtual| |const| |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | :ref:`Mode<enum_Shader_Mode>` | :ref:`_get_shader_mode<class_Material_private_method__get_shader_mode>`\ (\ ) |virtual| |const| |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | :ref:`RID<class_RID>` | :ref:`_get_shader_rid<class_Material_private_method__get_shader_rid>`\ (\ ) |virtual| |const| |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | :ref:`Resource<class_Resource>` | :ref:`create_placeholder<class_Material_method_create_placeholder>`\ (\ ) |const| |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`inspect_native_shader_code<class_Material_method_inspect_native_shader_code>`\ (\ ) |
- +---------------------------------+-----------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Constants
- ---------
- .. _class_Material_constant_RENDER_PRIORITY_MAX:
- .. rst-class:: classref-constant
- **RENDER_PRIORITY_MAX** = ``127`` :ref:`🔗<class_Material_constant_RENDER_PRIORITY_MAX>`
- Maximum value for the :ref:`render_priority<class_Material_property_render_priority>` parameter.
- .. _class_Material_constant_RENDER_PRIORITY_MIN:
- .. rst-class:: classref-constant
- **RENDER_PRIORITY_MIN** = ``-128`` :ref:`🔗<class_Material_constant_RENDER_PRIORITY_MIN>`
- Minimum value for the :ref:`render_priority<class_Material_property_render_priority>` parameter.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_Material_property_next_pass:
- .. rst-class:: classref-property
- :ref:`Material<class_Material>` **next_pass** :ref:`🔗<class_Material_property_next_pass>`
- .. rst-class:: classref-property-setget
- - |void| **set_next_pass**\ (\ value\: :ref:`Material<class_Material>`\ )
- - :ref:`Material<class_Material>` **get_next_pass**\ (\ )
- Sets the **Material** to be used for the next pass. This renders the object again using a different material.
- \ **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.
- \ **Note:** This only applies to :ref:`StandardMaterial3D<class_StandardMaterial3D>`\ s and :ref:`ShaderMaterial<class_ShaderMaterial>`\ s with type "Spatial".
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_property_render_priority:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **render_priority** :ref:`🔗<class_Material_property_render_priority>`
- .. rst-class:: classref-property-setget
- - |void| **set_render_priority**\ (\ value\: :ref:`int<class_int>`\ )
- - :ref:`int<class_int>` **get_render_priority**\ (\ )
- 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``.
- \ **Note:** This only applies to :ref:`StandardMaterial3D<class_StandardMaterial3D>`\ s and :ref:`ShaderMaterial<class_ShaderMaterial>`\ s with type "Spatial".
- \ **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.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_Material_private_method__can_do_next_pass:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **_can_do_next_pass**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__can_do_next_pass>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_private_method__can_use_render_priority:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **_can_use_render_priority**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__can_use_render_priority>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_private_method__get_shader_mode:
- .. rst-class:: classref-method
- :ref:`Mode<enum_Shader_Mode>` **_get_shader_mode**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__get_shader_mode>`
- Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_private_method__get_shader_rid:
- .. rst-class:: classref-method
- :ref:`RID<class_RID>` **_get_shader_rid**\ (\ ) |virtual| |const| :ref:`🔗<class_Material_private_method__get_shader_rid>`
- 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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_method_create_placeholder:
- .. rst-class:: classref-method
- :ref:`Resource<class_Resource>` **create_placeholder**\ (\ ) |const| :ref:`🔗<class_Material_method_create_placeholder>`
- Creates a placeholder version of this resource (:ref:`PlaceholderMaterial<class_PlaceholderMaterial>`).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Material_method_inspect_native_shader_code:
- .. rst-class:: classref-method
- |void| **inspect_native_shader_code**\ (\ ) :ref:`🔗<class_Material_method_inspect_native_shader_code>`
- 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>`.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|