Inherits: Material < Resource < Reference < Object
Default 3D rendering material.
This provides a default material with a wide variety of rendering features and properties without the need to write shader code. See the tutorial below for details.
bool | get_feature ( Feature feature ) const |
bool | get_flag ( Flags flag ) const |
Texture | get_texture ( TextureParam param ) const |
void | set_feature ( Feature feature, bool enable ) |
void | set_flag ( Flags flag, bool enable ) |
void | set_texture ( TextureParam param, Texture texture ) |
enum TextureParam:
enum DetailUV:
UV
with the detail texture.UV2
with the detail texture.enum Feature:
enum BlendMode:
enum DepthDrawMode:
enum CullMode:
enum Flags:
ALBEDO
.ALBEDO
to the per-vertex color specified in the mesh.POINT_COORD
instead of UV
.UV
.UV2
.UV2
coordinates to look up from the ao_texture.UV2
coordinates to look up from the emission_texture.enum DiffuseMode:
enum SpecularMode:
enum BillboardMode:
particles_anim_*
properties.The ParticlesMaterial.anim_speed or CPUParticles.anim_speed should also be set to a positive value for the animation to play.
enum TextureChannel:
enum EmissionOperator:
enum DistanceFadeMode:
Default | Color( 1, 1, 1, 1 ) |
Setter | set_albedo(value) |
Getter | get_albedo() |
The material's base color.
Setter | set_texture(value) |
Getter | get_texture() |
Texture to multiply by albedo_color. Used for basic texturing of objects.
Setter | set_anisotropy(value) |
Getter | get_anisotropy() |
The strength of the anisotropy effect.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, anisotropy is enabled. Changes the shape of the specular blob and aligns it to tangent space. Mesh tangents are needed for this to work. If the mesh does not contain tangents the anisotropy effect will appear broken.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that offsets the tangent map for anisotropy calculations.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, ambient occlusion is enabled. Ambient occlusion darkens areas based on the ao_texture.
Setter | set_ao_light_affect(value) |
Getter | get_ao_light_affect() |
Amount that ambient occlusion affects lighting from lights. If 0
, ambient occlusion only affects ambient light. If 1
, ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
Setter | set_flag(value) |
Getter | get_flag() |
If true
, use UV2
coordinates to look up from the ao_texture.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that defines the amount of ambient occlusion for a given point on the object.
Setter | set_ao_texture_channel(value) |
Getter | get_ao_texture_channel() |
Specifies the channel of the ao_texture in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
Setter | set_clearcoat(value) |
Getter | get_clearcoat() |
Sets the strength of the clearcoat effect. Setting to 0
looks the same as disabling the clearcoat effect.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, clearcoat rendering is enabled. Adds a secondary transparent pass to the lighting calculation resulting in an added specular blob. This makes materials appear as if they have a clear layer on them that can be either glossy or rough.
Setter | set_clearcoat_gloss(value) |
Getter | get_clearcoat_gloss() |
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that defines the strength of the clearcoat effect and the glossiness of the clearcoat. Strength is specified in the red channel while glossiness is specified in the green channel.
Setter | set_depth_deep_parallax(value) |
Getter | is_depth_deep_parallax_enabled() |
If true
, the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also normal_enabled.
Setter | set_depth_deep_parallax_flip_binormal(value) |
Getter | get_depth_deep_parallax_flip_binormal() |
If true
, direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
Setter | set_depth_deep_parallax_flip_tangent(value) |
Getter | get_depth_deep_parallax_flip_tangent() |
If true
, direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
Setter | set_depth_deep_parallax_max_layers(value) |
Getter | get_depth_deep_parallax_max_layers() |
Number of layers to use when using depth_deep_parallax and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
Setter | set_depth_deep_parallax_min_layers(value) |
Getter | get_depth_deep_parallax_min_layers() |
Number of layers to use when using depth_deep_parallax and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
Setter | set_depth_scale(value) |
Getter | get_depth_scale() |
Scales the depth offset effect. A higher number will create a larger depth.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to determine depth at a given pixel. Depth is always stored in the red channel.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that specifies the color of the detail overlay.
Setter | set_detail_blend_mode(value) |
Getter | get_detail_blend_mode() |
Specifies how the detail_albedo should blend with the current ALBEDO
. See BlendMode for options.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detail_mask. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to specify how the detail textures get blended with the base textures.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that specifies the per-pixel normal of the detail overlay.
Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
Setter | set_detail_uv(value) |
Getter | get_detail_uv() |
Specifies whether to use UV
or UV2
for the detail layer. See DetailUV for options.
Setter | set_distance_fade_max_distance(value) |
Getter | get_distance_fade_max_distance() |
Distance at which the object fades fully and is no longer visible.
Setter | set_distance_fade_min_distance(value) |
Getter | get_distance_fade_min_distance() |
Distance at which the object starts to fade. If the object is less than this distance away it will appear normal.
Default | 0 |
Setter | set_distance_fade(value) |
Getter | get_distance_fade() |
Specifies which type of fade to use. Can be any of the DistanceFadeModes.
Setter | set_emission(value) |
Getter | get_emission() |
The emitted light's color. See emission_enabled.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a GIProbe or BakedLightmap is used and this object is used in baked lighting.
Setter | set_emission_energy(value) |
Getter | get_emission_energy() |
The emitted light's strength. See emission_enabled.
Setter | set_flag(value) |
Getter | get_flag() |
Use UV2
to read from the emission_texture.
Setter | set_emission_operator(value) |
Getter | get_emission_operator() |
Sets how emission interacts with emission_texture. Can either add or multiply. See EmissionOperator for options.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that specifies how much surface emits light at a given point.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
Forces a conversion of the albedo_texture from sRGB space to linear space.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the object receives no ambient light.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the object receives no shadow that would otherwise be cast onto it.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the shader will compute extra operations to make sure the normal stays correct when using a non-uniform scale. Only enable if using non-uniform scaling.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the object is rendered at the same size regardless of distance.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, depth testing is disabled and the object will be drawn in render order.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, transparency is enabled on the body. See also params_blend_mode.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the object is unaffected by lighting.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, render point size can be changed.
Note: this is only effective for objects whose geometry is point-based rather than triangle-based. See also params_point_size.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, enables the "shadow to opacity" render mode where lighting modifies the alpha so shadowed areas are opaque and non-shadowed areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, triplanar mapping is calculated in world space rather than object local space. See also uv1_triplanar.
Default | 0.0 |
Setter | set_metallic(value) |
Getter | get_metallic() |
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between 0
and 1
should only be used for blending between metal and non-metal sections. To alter the amount of reflection use roughness.
Default | 0.5 |
Setter | set_specular(value) |
Getter | get_specular() |
Sets the size of the specular lobe. The specular lobe is the bright spot that is reflected from light sources.
Note: unlike metallic, this is not energy-conserving, so it should be left at 0.5
in most cases. See also roughness.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to specify metallic for an object. This is multiplied by metallic.
Default | 0 |
Setter | set_metallic_texture_channel(value) |
Getter | get_metallic_texture_channel() |
Specifies the channel of the metallic_texture in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, normal mapping is enabled.
Setter | set_normal_scale(value) |
Getter | get_normal_scale() |
The strength of the normal map's effect.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to specify the normal at a given pixel. The normal_texture
only uses the red and green channels. The normal read from normal_texture
is oriented around the surface normal provided by the Mesh.
Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.
Setter | set_alpha_scissor_threshold(value) |
Getter | get_alpha_scissor_threshold() |
Threshold at which the alpha scissor will discard values.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when params_billboard_mode is BILLBOARD_ENABLED.
Default | 0 |
Setter | set_billboard_mode(value) |
Getter | get_billboard_mode() |
Controls how the object faces the camera. See BillboardMode.
Default | 0 |
Setter | set_blend_mode(value) |
Getter | get_blend_mode() |
The material's blend mode.
Note: Values other than Mix
force the object into the transparent pipeline. See BlendMode.
Default | 0 |
Setter | set_cull_mode(value) |
Getter | get_cull_mode() |
Which side of the object is not drawn when backfaces are rendered. See CullMode.
Default | 0 |
Setter | set_depth_draw_mode(value) |
Getter | get_depth_draw_mode() |
Determines when depth rendering takes place. See DepthDrawMode. See also flags_transparent.
Default | 0 |
Setter | set_diffuse_mode(value) |
Getter | get_diffuse_mode() |
The algorithm used for diffuse light scattering. See DiffuseMode.
Default | false |
Setter | set_grow_enabled(value) |
Getter | is_grow_enabled() |
If true
, enables the vertex grow setting. See params_grow_amount.
Setter | set_grow(value) |
Getter | get_grow() |
Grows object vertices in the direction of their normals.
Default | 1.0 |
Setter | set_line_width(value) |
Getter | get_line_width() |
Currently unimplemented in Godot.
Default | 1.0 |
Setter | set_point_size(value) |
Getter | get_point_size() |
The point size in pixels. See flags_use_point_size.
Default | 0 |
Setter | set_specular_mode(value) |
Getter | get_specular_mode() |
The method for rendering the specular blob. See SpecularMode.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the shader will discard all pixels that have an alpha value less than params_alpha_scissor_threshold.
Setter | set_particles_anim_h_frames(value) |
Getter | get_particles_anim_h_frames() |
The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See params_billboard_mode.
Setter | set_particles_anim_loop(value) |
Getter | get_particles_anim_loop() |
If true
, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES. See params_billboard_mode.
Setter | set_particles_anim_v_frames(value) |
Getter | get_particles_anim_v_frames() |
The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See params_billboard_mode.
Setter | set_proximity_fade_distance(value) |
Getter | get_proximity_fade_distance() |
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
Default | false |
Setter | set_proximity_fade(value) |
Getter | is_proximity_fade_enabled() |
If true
, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, the refraction effect is enabled. Distorts transparency based on light from behind the object.
Setter | set_refraction(value) |
Getter | get_refraction() |
The strength of the refraction effect.
Setter | set_texture(value) |
Getter | get_texture() |
Texture that controls the strength of the refraction per-pixel. Multiplied by refraction_scale.
Setter | set_refraction_texture_channel(value) |
Getter | get_refraction_texture_channel() |
Specifies the channel of the ao_texture in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
Setter | set_rim(value) |
Getter | get_rim() |
Sets the strength of the rim lighting effect.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by rim.
Setter | set_rim_tint(value) |
Getter | get_rim_tint() |
The amount of to blend light and albedo color when rendering rim effect. If 0
the light color is used, while 1
means albedo color is used. An intermediate value generally works best.
Default | 1.0 |
Setter | set_roughness(value) |
Getter | get_roughness() |
Surface reflection. A value of 0
represents a perfect mirror while a value of 1
completely blurs the reflection. See also metallic.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to control the roughness per-pixel. Multiplied by roughness.
Default | 0 |
Setter | set_roughness_texture_channel(value) |
Getter | get_roughness_texture_channel() |
Specifies the channel of the ao_texture in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
Setter | set_subsurface_scattering_strength(value) |
Getter | get_subsurface_scattering_strength() |
The strength of the subsurface scattering effect.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by subsurf_scatter_strength.
Setter | set_transmission(value) |
Getter | get_transmission() |
The color used by the transmission effect. Represents the light passing through an object.
Default | false |
Setter | set_feature(value) |
Getter | get_feature() |
If true
, the transmission effect is enabled.
Setter | set_texture(value) |
Getter | get_texture() |
Texture used to control the transmission effect per-pixel. Added to transmission.
Default | Vector3( 0, 0, 0 ) |
Setter | set_uv1_offset(value) |
Getter | get_uv1_offset() |
How much to offset the UV
coordinates. This amount will be added to UV
in the vertex function. This can be used to offset a texture.
Default | Vector3( 1, 1, 1 ) |
Setter | set_uv1_scale(value) |
Getter | get_uv1_scale() |
How much to scale the UV
coordinates. This is multiplied by UV
in the vertex function.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, instead of using UV
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
Default | 1.0 |
Setter | set_uv1_triplanar_blend_sharpness(value) |
Getter | get_uv1_triplanar_blend_sharpness() |
A lower number blends the texture more softly while a higher number blends the texture more sharply.
Default | Vector3( 0, 0, 0 ) |
Setter | set_uv2_offset(value) |
Getter | get_uv2_offset() |
How much to offset the UV2
coordinates. This amount will be added to UV2
in the vertex function. This can be used to offset a texture.
Default | Vector3( 1, 1, 1 ) |
Setter | set_uv2_scale(value) |
Getter | get_uv2_scale() |
How much to scale the UV2
coordinates. This is multiplied by UV2
in the vertex function.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, instead of using UV2
textures will use a triplanar texture lookup to determine how to apply textures. Triplanar uses the orientation of the object's surface to blend between texture coordinates. It reads from the source texture 3 times, once for each axis and then blends between the results based on how closely the pixel aligns with each axis. This is often used for natural features to get a realistic blend of materials. Because triplanar texturing requires many more texture reads per-pixel it is much slower than normal UV texturing. Additionally, because it is blending the texture between the three axes, it is unsuitable when you are trying to achieve crisp texturing.
Default | 1.0 |
Setter | set_uv2_triplanar_blend_sharpness(value) |
Getter | get_uv2_triplanar_blend_sharpness() |
A lower number blends the texture more softly while a higher number blends the texture more sharply.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the model's vertex colors are processed as sRGB mode.
Default | false |
Setter | set_flag(value) |
Getter | get_flag() |
If true
, the vertex color is used as albedo color.
Returns true
, if the specified Feature is enabled.
Returns true
, if the specified flag is enabled. See Flags enumerator for options.
Returns the Texture associated with the specified TextureParam.
If true
, enables the specified Feature. Many features that are available in SpatialMaterial
s need to be enabled before use. This way the cost for using the feature is only incurred when specified. Features can also be enabled by setting the corresponding member to true
.
If true
, enables the specified flag. Flags are optional behaviour that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to true
. See Flags enumerator for options.
Sets the Texture to be used by the specified TextureParam. This function is called when setting members ending in *_texture
.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_spatialmaterial.html