Material
Virtual base class for applying visual properties to an object, such as color and roughness.
Material.swift:20class Material
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.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
static let renderPriorityMax: Int
Maximum value for the
renderPriority
parameter.static let renderPriorityMin: Int
Minimum value for the
renderPriority
parameter.class var godotClassName: StringName
Instance members
var nextPass: Material?
Sets the
Material
to be used for the next pass. This renders the object again using a different material.var renderPriority: Int32
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
renderPriority
1
will render before all objects withrenderPriority
0
.func createPlaceholder(
) -> Resource? Creates a placeholder version of this resource (
PlaceholderMaterial
).func inspectNativeShaderCode(
) Only available when running in the editor. Opens a popup that visualizes the generated shader code, including all variants and internal shader code.
Show implementation details (4)
Hide implementation details
func _canDoNextPass(
) -> Bool Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if
nextPass
should be shown in the editor or not.func _canUseRenderPriority(
) -> Bool Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if
renderPriority
should be shown in the editor or not.func _getShaderMode(
) -> Shader.Mode Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools.
func _getShaderRid(
) -> 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
’sShader
.
Subclasses
class BaseMaterial3D
Abstract base class for defining the 3D rendering properties of meshes.
class CanvasItemMaterial
A material for
CanvasItem
s.class FogMaterial
A material that controls how volumetric fog is rendered, to be assigned to a
FogVolume
.class PanoramaSkyMaterial
A material that provides a special texture to a
Sky
, usually an HDR panorama.class ParticleProcessMaterial
Holds a particle configuration for
GPUParticles2D
orGPUParticles3D
nodes.class PhysicalSkyMaterial
A material that defines a sky for a
Sky
resource by a set of physical properties.class PlaceholderMaterial
Placeholder class for a material.
class ProceduralSkyMaterial
A material that defines a simple sky for a
Sky
resource.class ShaderMaterial
A material defined by a custom
Shader
program and the values of its shader parameters.