Material
继承: Resource
< RefCounted
< Object
派生: BaseMaterial3D
, CanvasItemMaterial
, FogMaterial
, PanoramaSkyMaterial
, ParticleProcessMaterial
, PhysicalSkyMaterial
, PlaceholderMaterial
, ProceduralSkyMaterial
, ShaderMaterial
Virtual base class for applying visual properties to an object, such as color and roughness.
描述
Material is a base resource used for coloring and shading geometry. All materials inherit from it and almost all 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.
属性
方法
bool | _can_do_next_pass ( ) virtual1 const2 |
bool | _can_use_render_priority ( ) virtual1 const2 |
Mode | _get_shader_mode ( ) virtual1 const2 |
RID | _get_shader_rid ( ) virtual1 const2 |
Resource | create_placeholder ( ) const2 |
void | inspect_native_shader_code ( ) |
常量
RENDER_PRIORITY_MAX = 127
Maximum value for the render_priority
parameter.
RENDER_PRIORITY_MIN = -128
Minimum value for the render_priority
parameter.
属性说明
Material
next_pass
Sets the Material to be used for the next pass. This renders the object again using a different material.
Note: next_pass
materials are not necessarily drawn immediately after the source Material. Draw order is determined by material properties, render_priority
, and distance to camera.
Note: This only applies to StandardMaterial3D
s and ShaderMaterial
s with type "Spatial".
int
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 render_priority
1
will render before all objects with render_priority
0
.
Note: This only applies to StandardMaterial3D
s and 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.
方法说明
bool
_can_do_next_pass ( ) virtual1 const2
Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if next_pass
should be shown in the editor or not.
bool
_can_use_render_priority ( ) virtual1 const2
Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if render_priority
should be shown in the editor or not.
Mode _get_shader_mode ( ) virtual1 const2
Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools.
RID
_get_shader_rid ( ) virtual1 const2
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 Shader
.
Resource
create_placeholder ( ) const2
Creates a placeholder version of this resource (PlaceholderMaterial
).
void
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 Shader.inspect_native_shader_code
.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。