Table of Contents

Class BaseMaterial3D

Abstract base class for defining the 3D rendering properties of meshes.

Inheritance
BaseMaterial3D
Derived

Remarks

This class serves as 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.

See Also

Properties

albedo_color

The material's base color.

Note: If detail_enabled is true and a detail_albedo texture is specified, albedo_color will not modulate the detail texture. This can be used to color partial areas of a material by not specifying an albedo texture and using a transparent detail_albedo texture instead.

var albedo_color : Color = Color(1, 1, 1, 1)

Property Value

Color

Remarks

albedo_texture

Texture to multiply by albedo_color. Used for basic texturing of objects.

If the texture appears unexpectedly too dark or too bright, check albedo_texture_force_srgb.

var albedo_texture : Texture2D

Property Value

Texture2D

Remarks

albedo_texture_force_srgb

If true, forces a conversion of the albedo_texture from sRGB color space to linear color space. See also vertex_color_is_srgb.

This should only be enabled when needed (typically when using a ViewportTexture as albedo_texture). If albedo_texture_force_srgb is true when it shouldn't be, the texture will appear to be too dark. If albedo_texture_force_srgb is false when it shouldn't be, the texture will appear to be too bright.

var albedo_texture_force_srgb : bool = false

Property Value

bool

Remarks

albedo_texture_msdf

Enables multichannel signed distance field rendering shader. Use msdf_pixel_range and msdf_outline_size to configure MSDF parameters.

var albedo_texture_msdf : bool = false

Property Value

bool

Remarks

alpha_antialiasing_edge

Threshold at which antialiasing will be applied on the alpha channel.

var alpha_antialiasing_edge : float

Property Value

float

Remarks

  • void set_alpha_antialiasing_edge(float value)
  • float get_alpha_antialiasing_edge

alpha_antialiasing_mode

The type of alpha antialiasing to apply. See AlphaAntiAliasing.

var alpha_antialiasing_mode : int

Property Value

int

Remarks

  • void set_alpha_antialiasing(int value)
  • int get_alpha_antialiasing

alpha_hash_scale

The hashing scale for Alpha Hash. Recommended values between 0 and 2.

var alpha_hash_scale : float

Property Value

float

Remarks

  • void set_alpha_hash_scale(float value)
  • float get_alpha_hash_scale

alpha_scissor_threshold

Threshold at which the alpha scissor will discard values. Higher values will result in more pixels being discarded. If the material becomes too opaque at a distance, try increasing alpha_scissor_threshold. If the material disappears at a distance, try decreasing alpha_scissor_threshold.

var alpha_scissor_threshold : float

Property Value

float

Remarks

  • void set_alpha_scissor_threshold(float value)
  • float get_alpha_scissor_threshold

anisotropy

The strength of the anisotropy effect. This is multiplied by anisotropy_flowmap's alpha channel if a texture is defined there and the texture contains an alpha channel.

var anisotropy : float = 0.0

Property Value

float

Remarks

  • void set_anisotropy(float value)
  • float get_anisotropy

anisotropy_enabled

If true, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminum and hair reflections.

Note: Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken.

Note: Material anisotropy should not to be confused with anisotropic texture filtering, which can be enabled by setting texture_filter to BaseMaterial3D.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC.

var anisotropy_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

anisotropy_flowmap

Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion.

If present, the texture's alpha channel will be used to multiply the strength of the anisotropy effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored.

var anisotropy_flowmap : Texture2D

Property Value

Texture2D

Remarks

ao_enabled

If true, ambient occlusion is enabled. Ambient occlusion darkens areas based on the ao_texture.

var ao_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

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.

var ao_light_affect : float = 0.0

Property Value

float

Remarks

  • void set_ao_light_affect(float value)
  • float get_ao_light_affect

ao_on_uv2

If true, use UV2 coordinates to look up from the ao_texture.

var ao_on_uv2 : bool = false

Property Value

bool

Remarks

ao_texture

Texture that defines the amount of ambient occlusion for a given point on the object.

var ao_texture : Texture2D

Property Value

Texture2D

Remarks

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.

var ao_texture_channel : int = 0

Property Value

int

Remarks

  • void set_ao_texture_channel(int value)
  • int get_ao_texture_channel

backlight

The color used by the backlight effect. Represents the light passing through an object.

var backlight : Color = Color(0, 0, 0, 1)

Property Value

Color

Remarks

  • void set_backlight(Color value)
  • Color get_backlight

backlight_enabled

If true, the backlight effect is enabled. See also subsurf_scatter_transmittance_enabled.

var backlight_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

backlight_texture

Texture used to control the backlight effect per-pixel. Added to backlight.

var backlight_texture : Texture2D

Property Value

Texture2D

Remarks

billboard_keep_scale

If true, the shader will keep the scale set for the mesh. Otherwise, the scale is lost when billboarding. Only applies when billboard_mode is not BaseMaterial3D.BILLBOARD_DISABLED.

var billboard_keep_scale : bool = false

Property Value

bool

Remarks

billboard_mode

Controls how the object faces the camera. See BillboardMode.

Note: Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See GitHub issue #41567 for details.

var billboard_mode : int = 0

Property Value

int

Remarks

  • void set_billboard_mode(int value)
  • int get_billboard_mode

blend_mode

The material's blend mode.

Note: Values other than Mix force the object into the transparent pipeline. See BlendMode.

var blend_mode : int = 0

Property Value

int

Remarks

  • void set_blend_mode(int value)
  • int get_blend_mode

clearcoat

Sets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.

var clearcoat : float = 1.0

Property Value

float

Remarks

  • void set_clearcoat(float value)
  • float get_clearcoat

clearcoat_enabled

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.

Note: Clearcoat rendering is not visible if the material's shading_mode is BaseMaterial3D.SHADING_MODE_UNSHADED.

var clearcoat_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

clearcoat_roughness

Sets the roughness of the clearcoat pass. A higher value results in a rougher clearcoat while a lower value results in a smoother clearcoat.

var clearcoat_roughness : float = 0.5

Property Value

float

Remarks

  • void set_clearcoat_roughness(float value)
  • float get_clearcoat_roughness

clearcoat_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.

var clearcoat_texture : Texture2D

Property Value

Texture2D

Remarks

cull_mode

Determines which side of the triangle to cull depending on whether the triangle faces towards or away from the camera. See CullMode.

var cull_mode : int = 0

Property Value

int

Remarks

  • void set_cull_mode(int value)
  • int get_cull_mode

depth_draw_mode

Determines when depth rendering takes place. See DepthDrawMode. See also transparency.

var depth_draw_mode : int = 0

Property Value

int

Remarks

  • void set_depth_draw_mode(int value)
  • int get_depth_draw_mode

detail_albedo

Texture that specifies the color of the detail overlay. detail_albedo's alpha channel is used as a mask, even when the material is opaque. To use a dedicated texture as a mask, see detail_mask.

Note: detail_albedo is not modulated by albedo_color.

var detail_albedo : Texture2D

Property Value

Texture2D

Remarks

detail_blend_mode

Specifies how the detail_albedo should blend with the current ALBEDO. See BlendMode for options.

var detail_blend_mode : int = 0

Property Value

int

Remarks

  • void set_detail_blend_mode(int value)
  • int get_detail_blend_mode

detail_enabled

If true, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detail_mask and detail_albedo's alpha channel. This can be used to add variation to objects, or to blend between two different albedo/normal textures.

var detail_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

detail_mask

Texture used to specify how the detail textures get blended with the base textures. detail_mask can be used together with detail_albedo's alpha channel (if any).

var detail_mask : Texture2D

Property Value

Texture2D

Remarks

detail_normal

Texture that specifies the per-pixel normal of the detail overlay. The detail_normal texture only uses the red and green channels; the blue and alpha channels are ignored. The normal read from detail_normal 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.

var detail_normal : Texture2D

Property Value

Texture2D

Remarks

detail_uv_layer

Specifies whether to use UV or UV2 for the detail layer. See DetailUV for options.

var detail_uv_layer : int = 0

Property Value

int

Remarks

  • void set_detail_uv(int value)
  • int get_detail_uv

diffuse_mode

The algorithm used for diffuse light scattering. See DiffuseMode.

var diffuse_mode : int = 0

Property Value

int

Remarks

  • void set_diffuse_mode(int value)
  • int get_diffuse_mode

disable_ambient_light

If true, the object receives no ambient light.

var disable_ambient_light : bool = false

Property Value

bool

Remarks

disable_fog

If true, the object will not be affected by fog (neither volumetric nor depth fog). This is useful for unshaded or transparent materials (e.g. particles), which without this setting will be affected even if fully transparent.

var disable_fog : bool = false

Property Value

bool

Remarks

disable_receive_shadows

If true, the object receives no shadow that would otherwise be cast onto it.

var disable_receive_shadows : bool = false

Property Value

bool

Remarks

distance_fade_max_distance

Distance at which the object appears fully opaque.

Note: If distance_fade_max_distance is less than distance_fade_min_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.

var distance_fade_max_distance : float = 10.0

Property Value

float

Remarks

  • void set_distance_fade_max_distance(float value)
  • float get_distance_fade_max_distance

distance_fade_min_distance

Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.

Note: If distance_fade_min_distance is greater than distance_fade_max_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.

var distance_fade_min_distance : float = 0.0

Property Value

float

Remarks

  • void set_distance_fade_min_distance(float value)
  • float get_distance_fade_min_distance

distance_fade_mode

Specifies which type of fade to use. Can be any of the DistanceFadeModes.

var distance_fade_mode : int = 0

Property Value

int

Remarks

  • void set_distance_fade(int value)
  • int get_distance_fade

emission

The emitted light's color. See emission_enabled.

var emission : Color = Color(0, 0, 0, 1)

Property Value

Color

Remarks

  • void set_emission(Color value)
  • Color get_emission

emission_enabled

If true, the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a VoxelGI, SDFGI, or LightmapGI is used and this object is used in baked lighting.

var emission_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

emission_energy_multiplier

Multiplier for emitted light. See emission_enabled.

var emission_energy_multiplier : float = 1.0

Property Value

float

Remarks

  • void set_emission_energy_multiplier(float value)
  • float get_emission_energy_multiplier

emission_intensity

Luminance of emitted light, measured in nits (candela per square meter). Only available when rendering/lights_and_shadows/use_physical_light_units is enabled. The default is roughly equivalent to an indoor lightbulb.

var emission_intensity : float

Property Value

float

Remarks

  • void set_emission_intensity(float value)
  • float get_emission_intensity

emission_on_uv2

Use UV2 to read from the emission_texture.

var emission_on_uv2 : bool = false

Property Value

bool

Remarks

emission_operator

Sets how emission interacts with emission_texture. Can either add or multiply. See EmissionOperator for options.

var emission_operator : int = 0

Property Value

int

Remarks

  • void set_emission_operator(int value)
  • int get_emission_operator

emission_texture

Texture that specifies how much surface emits light at a given point.

var emission_texture : Texture2D

Property Value

Texture2D

Remarks

fixed_size

If true, the object is rendered at the same size regardless of distance.

var fixed_size : bool = false

Property Value

bool

Remarks

grow

If true, enables the vertex grow setting. This can be used to create mesh-based outlines using a second material pass and its cull_mode set to BaseMaterial3D.CULL_FRONT. See also grow_amount.

Note: Vertex growth cannot create new vertices, which means that visible gaps may occur in sharp corners. This can be alleviated by designing the mesh to use smooth normals exclusively using face weighted normals in the 3D authoring software. In this case, grow will be able to join every outline together, just like in the original mesh.

var grow : bool = false

Property Value

bool

Remarks

  • void set_grow_enabled(bool value)
  • bool is_grow_enabled

grow_amount

Grows object vertices in the direction of their normals. Only effective if grow is true.

var grow_amount : float = 0.0

Property Value

float

Remarks

heightmap_deep_parallax

If true, uses parallax occlusion mapping to represent depth in the material instead of simple offset mapping (see heightmap_enabled). This results in a more convincing depth effect, but is much more expensive on the GPU. Only enable this on materials where it makes a significant visual difference.

var heightmap_deep_parallax : bool = false

Property Value

bool

Remarks

  • void set_heightmap_deep_parallax(bool value)
  • bool is_heightmap_deep_parallax_enabled

heightmap_enabled

If true, height mapping is enabled (also called "parallax mapping" or "depth mapping"). See also normal_enabled. Height mapping is a demanding feature on the GPU, so it should only be used on materials where it makes a significant visual difference.

Note: Height mapping is not supported if triplanar mapping is used on the same material. The value of heightmap_enabled will be ignored if uv1_triplanar is enabled.

var heightmap_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

heightmap_flip_binormal

If true, flips the mesh's binormal vectors when interpreting the height map. If the heightmap effect looks strange when the camera moves (even with a reasonable heightmap_scale), try setting this to true.

var heightmap_flip_binormal : bool = false

Property Value

bool

Remarks

  • void set_heightmap_deep_parallax_flip_binormal(bool value)
  • bool get_heightmap_deep_parallax_flip_binormal

heightmap_flip_tangent

If true, flips the mesh's tangent vectors when interpreting the height map. If the heightmap effect looks strange when the camera moves (even with a reasonable heightmap_scale), try setting this to true.

var heightmap_flip_tangent : bool = false

Property Value

bool

Remarks

  • void set_heightmap_deep_parallax_flip_tangent(bool value)
  • bool get_heightmap_deep_parallax_flip_tangent

heightmap_flip_texture

If true, interprets the height map texture as a depth map, with brighter values appearing to be "lower" in altitude compared to darker values.

This can be enabled for compatibility with some materials authored for Godot 3.x. This is not necessary if the Invert import option was used to invert the depth map in Godot 3.x, in which case heightmap_flip_texture should remain false.

var heightmap_flip_texture : bool = false

Property Value

bool

Remarks

heightmap_max_layers

The number of layers to use for parallax occlusion mapping when the camera is up close to the material. Higher values result in a more convincing depth effect, especially in materials that have steep height changes. Higher values have a significant cost on the GPU, so it should only be increased on materials where it makes a significant visual difference.

Note: Only effective if heightmap_deep_parallax is true.

var heightmap_max_layers : int

Property Value

int

Remarks

  • void set_heightmap_deep_parallax_max_layers(int value)
  • int get_heightmap_deep_parallax_max_layers

heightmap_min_layers

The number of layers to use for parallax occlusion mapping when the camera is far away from the material. Higher values result in a more convincing depth effect, especially in materials that have steep height changes. Higher values have a significant cost on the GPU, so it should only be increased on materials where it makes a significant visual difference.

Note: Only effective if heightmap_deep_parallax is true.

var heightmap_min_layers : int

Property Value

int

Remarks

  • void set_heightmap_deep_parallax_min_layers(int value)
  • int get_heightmap_deep_parallax_min_layers

heightmap_scale

The heightmap scale to use for the parallax effect (see heightmap_enabled). The default value is tuned so that the highest point (value = 255) appears to be 5 cm higher than the lowest point (value = 0). Higher values result in a deeper appearance, but may result in artifacts appearing when looking at the material from oblique angles, especially when the camera moves. Negative values can be used to invert the parallax effect, but this is different from inverting the texture using heightmap_flip_texture as the material will also appear to be "closer" to the camera. In most cases, heightmap_scale should be kept to a positive value.

Note: If the height map effect looks strange regardless of this value, try adjusting heightmap_flip_binormal and heightmap_flip_tangent. See also heightmap_texture for recommendations on authoring heightmap textures, as the way the heightmap texture is authored affects how heightmap_scale behaves.

var heightmap_scale : float = 5.0

Property Value

float

Remarks

  • void set_heightmap_scale(float value)
  • float get_heightmap_scale

heightmap_texture

The texture to use as a height map. See also heightmap_enabled.

For best results, the texture should be normalized (with heightmap_scale reduced to compensate). In GIMP, this can be done using Colors > Auto > Equalize. If the texture only uses a small part of its available range, the parallax effect may look strange, especially when the camera moves.

Note: To reduce memory usage and improve loading times, you may be able to use a lower-resolution heightmap texture as most heightmaps are only comprised of low-frequency data.

var heightmap_texture : Texture2D

Property Value

Texture2D

Remarks

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.

var metallic : float = 0.0

Property Value

float

Remarks

  • void set_metallic(float value)
  • float get_metallic

metallic_specular

Adjusts the strength of specular reflections. Specular reflections are composed of scene reflections and the specular lobe which is the bright spot that is reflected from light sources. When set to 0.0, no specular reflections will be visible. This differs from the BaseMaterial3D.SPECULAR_DISABLED SpecularMode as BaseMaterial3D.SPECULAR_DISABLED only applies to the specular lobe from the light source.

Note: Unlike metallic, this is not energy-conserving, so it should be left at 0.5 in most cases. See also roughness.

var metallic_specular : float = 0.5

Property Value

float

Remarks

  • void set_specular(float value)
  • float get_specular

metallic_texture

Texture used to specify metallic for an object. This is multiplied by metallic.

var metallic_texture : Texture2D

Property Value

Texture2D

Remarks

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.

var metallic_texture_channel : int = 0

Property Value

int

Remarks

  • void set_metallic_texture_channel(int value)
  • int get_metallic_texture_channel

msdf_outline_size

The width of the shape outline.

var msdf_outline_size : float = 0.0

Property Value

float

Remarks

  • void set_msdf_outline_size(float value)
  • float get_msdf_outline_size

msdf_pixel_range

The width of the range around the shape between the minimum and maximum representable signed distance.

var msdf_pixel_range : float = 4.0

Property Value

float

Remarks

  • void set_msdf_pixel_range(float value)
  • float get_msdf_pixel_range

no_depth_test

If true, depth testing is disabled and the object will be drawn in render order.

var no_depth_test : bool = false

Property Value

bool

Remarks

normal_enabled

If true, normal mapping is enabled. This has a slight performance cost, especially on mobile GPUs.

var normal_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

normal_scale

The strength of the normal map's effect.

var normal_scale : float = 1.0

Property Value

float

Remarks

  • void set_normal_scale(float value)
  • float get_normal_scale

normal_texture

Texture used to specify the normal at a given pixel. The normal_texture only uses the red and green channels; the blue and alpha channels are ignored. The normal read from normal_texture is oriented around the surface normal provided by the Mesh.

Note: The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with SurfaceTool, you can use SurfaceTool.generate_normals and generate_tangents to automatically generate normals and tangents respectively.

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.

Note: If detail_enabled is true, the detail_albedo texture is drawn below the normal_texture. To display a normal map above the detail_albedo texture, use detail_normal instead.

var normal_texture : Texture2D

Property Value

Texture2D

Remarks

orm_texture

The Occlusion/Roughness/Metallic texture to use. This is a more efficient replacement of ao_texture, roughness_texture and metallic_texture in ORMMaterial3D. Ambient occlusion is stored in the red channel. Roughness map is stored in the green channel. Metallic map is stored in the blue channel. The alpha channel is ignored.

var orm_texture : Texture2D

Property Value

Texture2D

Remarks

particles_anim_h_frames

The number of horizontal frames in the particle sprite sheet. Only enabled when using BaseMaterial3D.BILLBOARD_PARTICLES. See billboard_mode.

var particles_anim_h_frames : int

Property Value

int

Remarks

  • void set_particles_anim_h_frames(int value)
  • int get_particles_anim_h_frames

particles_anim_loop

If true, particle animations are looped. Only enabled when using BaseMaterial3D.BILLBOARD_PARTICLES. See billboard_mode.

var particles_anim_loop : bool

Property Value

bool

Remarks

  • void set_particles_anim_loop(bool value)
  • bool get_particles_anim_loop

particles_anim_v_frames

The number of vertical frames in the particle sprite sheet. Only enabled when using BaseMaterial3D.BILLBOARD_PARTICLES. See billboard_mode.

var particles_anim_v_frames : int

Property Value

int

Remarks

  • void set_particles_anim_v_frames(int value)
  • int get_particles_anim_v_frames

point_size

The point size in pixels. See use_point_size.

var point_size : float = 1.0

Property Value

float

Remarks

  • void set_point_size(float value)
  • float get_point_size

proximity_fade_distance

Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.

var proximity_fade_distance : float = 1.0

Property Value

float

Remarks

  • void set_proximity_fade_distance(float value)
  • float get_proximity_fade_distance

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.

var proximity_fade_enabled : bool = false

Property Value

bool

Remarks

  • void set_proximity_fade_enabled(bool value)
  • bool is_proximity_fade_enabled

refraction_enabled

If true, the refraction effect is enabled. Distorts transparency based on light from behind the object.

Note: Refraction is implemented using the screen texture. Only opaque materials will appear in the refraction, since transparent materials do not appear in the screen texture.

var refraction_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

refraction_scale

The strength of the refraction effect.

var refraction_scale : float = 0.05

Property Value

float

Remarks

  • void set_refraction(float value)
  • float get_refraction

refraction_texture

Texture that controls the strength of the refraction per-pixel. Multiplied by refraction_scale.

var refraction_texture : Texture2D

Property Value

Texture2D

Remarks

refraction_texture_channel

Specifies the channel of the refraction_texture in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored refraction in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.

var refraction_texture_channel : int = 0

Property Value

int

Remarks

  • void set_refraction_texture_channel(int value)
  • int get_refraction_texture_channel

rim

Sets the strength of the rim lighting effect.

var rim : float = 1.0

Property Value

float

Remarks

rim_enabled

If true, rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.

Note: Rim lighting is not visible if the material's shading_mode is BaseMaterial3D.SHADING_MODE_UNSHADED.

var rim_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

rim_texture

Texture used to set the strength of the rim lighting effect per-pixel. Multiplied by rim.

var rim_texture : Texture2D

Property Value

Texture2D

Remarks

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.

var rim_tint : float = 0.5

Property Value

float

Remarks

  • void set_rim_tint(float value)
  • float get_rim_tint

roughness

Surface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also metallic.

var roughness : float = 1.0

Property Value

float

Remarks

  • void set_roughness(float value)
  • float get_roughness

roughness_texture

Texture used to control the roughness per-pixel. Multiplied by roughness.

var roughness_texture : Texture2D

Property Value

Texture2D

Remarks

roughness_texture_channel

Specifies the channel of the roughness_texture in which the roughness 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.

var roughness_texture_channel : int = 0

Property Value

int

Remarks

  • void set_roughness_texture_channel(int value)
  • int get_roughness_texture_channel

shading_mode

Sets whether the shading takes place, per-pixel, per-vertex or unshaded. Per-vertex lighting is faster, making it the best choice for mobile applications, however it looks considerably worse than per-pixel. Unshaded rendering is the fastest, but disables all interactions with lights.

var shading_mode : int = 1

Property Value

int

Remarks

  • void set_shading_mode(int value)
  • int get_shading_mode

shadow_to_opacity

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.

var shadow_to_opacity : bool = false

Property Value

bool

Remarks

specular_mode

The method for rendering the specular blob. See SpecularMode.

Note: specular_mode only applies to the specular blob. It does not affect specular reflections from the sky, screen-space reflections, VoxelGI, SDFGI or ReflectionProbes. To disable reflections from these sources as well, set metallic_specular to 0.0 instead.

var specular_mode : int = 0

Property Value

int

Remarks

  • void set_specular_mode(int value)
  • int get_specular_mode

subsurf_scatter_enabled

If true, subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges. Subsurface scattering quality is controlled by rendering/environment/subsurface_scattering/subsurface_scattering_quality.

var subsurf_scatter_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

subsurf_scatter_skin_mode

If true, subsurface scattering will use a special mode optimized for the color and density of human skin, such as boosting the intensity of the red channel in subsurface scattering.

var subsurf_scatter_skin_mode : bool = false

Property Value

bool

Remarks

subsurf_scatter_strength

The strength of the subsurface scattering effect. The depth of the effect is also controlled by rendering/environment/subsurface_scattering/subsurface_scattering_scale, which is set globally.

var subsurf_scatter_strength : float = 0.0

Property Value

float

Remarks

  • void set_subsurface_scattering_strength(float value)
  • float get_subsurface_scattering_strength

subsurf_scatter_texture

Texture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by subsurf_scatter_strength.

var subsurf_scatter_texture : Texture2D

Property Value

Texture2D

Remarks

subsurf_scatter_transmittance_boost

The intensity of the subsurface scattering transmittance effect.

var subsurf_scatter_transmittance_boost : float = 0.0

Property Value

float

Remarks

  • void set_transmittance_boost(float value)
  • float get_transmittance_boost

subsurf_scatter_transmittance_color

The color to multiply the subsurface scattering transmittance effect with. Ignored if subsurf_scatter_skin_mode is true.

var subsurf_scatter_transmittance_color : Color = Color(1, 1, 1, 1)

Property Value

Color

Remarks

  • void set_transmittance_color(Color value)
  • Color get_transmittance_color

subsurf_scatter_transmittance_depth

The depth of the subsurface scattering transmittance effect.

var subsurf_scatter_transmittance_depth : float = 0.1

Property Value

float

Remarks

  • void set_transmittance_depth(float value)
  • float get_transmittance_depth

subsurf_scatter_transmittance_enabled

If true, enables subsurface scattering transmittance. Only effective if subsurf_scatter_enabled is true. See also backlight_enabled.

var subsurf_scatter_transmittance_enabled : bool = false

Property Value

bool

Remarks

  • void set_feature(int feature, bool enable)
  • bool get_feature(int feature)

subsurf_scatter_transmittance_texture

The texture to use for multiplying the intensity of the subsurface scattering transmittance intensity. See also subsurf_scatter_texture. Ignored if subsurf_scatter_skin_mode is true.

var subsurf_scatter_transmittance_texture : Texture2D

Property Value

Texture2D

Remarks

texture_filter

Filter flags for the texture. See TextureFilter for options.

Note: heightmap_texture is always sampled with linear filtering, even if nearest-neighbor filtering is selected here. This is to ensure the heightmap effect looks as intended. If you need sharper height transitions between pixels, resize the heightmap texture in an image editor with nearest-neighbor filtering.

var texture_filter : int = 3

Property Value

int

Remarks

  • void set_texture_filter(int value)
  • int get_texture_filter

texture_repeat

Repeat flags for the texture. See TextureFilter for options.

var texture_repeat : bool = true

Property Value

bool

Remarks

transparency

The material's transparency mode. Some transparency modes will disable shadow casting. Any transparency mode other than BaseMaterial3D.TRANSPARENCY_DISABLED has a greater performance impact compared to opaque rendering. See also blend_mode.

var transparency : int = 0

Property Value

int

Remarks

  • void set_transparency(int value)
  • int get_transparency

use_particle_trails

If true, enables parts of the shader required for GPUParticles3D trails to function. This also requires using a mesh with appropriate skinning, such as RibbonTrailMesh or TubeTrailMesh. Enabling this feature outside of materials used in GPUParticles3D meshes will break material rendering.

var use_particle_trails : bool = false

Property Value

bool

Remarks

use_point_size

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 point_size.

var use_point_size : bool = false

Property Value

bool

Remarks

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. The Z component is used when uv1_triplanar is enabled, but it is not used anywhere else.

var uv1_offset : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

uv1_scale

How much to scale the UV coordinates. This is multiplied by UV in the vertex function. The Z component is used when uv1_triplanar is enabled, but it is not used anywhere else.

var uv1_scale : Vector3 = Vector3(1, 1, 1)

Property Value

Vector3

Remarks

uv1_triplanar

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.

var uv1_triplanar : bool = false

Property Value

bool

Remarks

uv1_triplanar_sharpness

A lower number blends the texture more softly while a higher number blends the texture more sharply.

Note: uv1_triplanar_sharpness is clamped between 0.0 and 150.0 (inclusive) as values outside that range can look broken depending on the mesh.

var uv1_triplanar_sharpness : float = 1.0

Property Value

float

Remarks

  • void set_uv1_triplanar_blend_sharpness(float value)
  • float get_uv1_triplanar_blend_sharpness

uv1_world_triplanar

If true, triplanar mapping for UV is calculated in world space rather than object local space. See also uv1_triplanar.

var uv1_world_triplanar : bool = false

Property Value

bool

Remarks

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. The Z component is used when uv2_triplanar is enabled, but it is not used anywhere else.

var uv2_offset : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

uv2_scale

How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function. The Z component is used when uv2_triplanar is enabled, but it is not used anywhere else.

var uv2_scale : Vector3 = Vector3(1, 1, 1)

Property Value

Vector3

Remarks

uv2_triplanar

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.

var uv2_triplanar : bool = false

Property Value

bool

Remarks

uv2_triplanar_sharpness

A lower number blends the texture more softly while a higher number blends the texture more sharply.

Note: uv2_triplanar_sharpness is clamped between 0.0 and 150.0 (inclusive) as values outside that range can look broken depending on the mesh.

var uv2_triplanar_sharpness : float = 1.0

Property Value

float

Remarks

  • void set_uv2_triplanar_blend_sharpness(float value)
  • float get_uv2_triplanar_blend_sharpness

uv2_world_triplanar

If true, triplanar mapping for UV2 is calculated in world space rather than object local space. See also uv2_triplanar.

var uv2_world_triplanar : bool = false

Property Value

bool

Remarks

vertex_color_is_srgb

If true, vertex colors are considered to be stored in sRGB color space and are converted to linear color space during rendering. If false, vertex colors are considered to be stored in linear color space and are rendered as-is. See also albedo_texture_force_srgb.

Note: Only effective when using the Forward+ and Mobile rendering methods, not Compatibility.

var vertex_color_is_srgb : bool = false

Property Value

bool

Remarks

vertex_color_use_as_albedo

If true, the vertex color is used as albedo color.

var vertex_color_use_as_albedo : bool = false

Property Value

bool

Remarks

Methods

get_feature(int)

Qualifiers: const

Returns true, if the specified Feature is enabled.

bool get_feature(int feature)

Parameters

feature int

get_flag(int)

Qualifiers: const

Returns true, if the specified flag is enabled. See Flags enumerator for options.

bool get_flag(int flag)

Parameters

flag int

get_texture(int)

Qualifiers: const

Returns the Texture2D associated with the specified TextureParam.

Texture2D get_texture(int param)

Parameters

param int

set_feature(int, bool)

If true, enables the specified Feature. Many features that are available in BaseMaterial3Ds 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.

void set_feature(int feature, bool enable)

Parameters

feature int
enable bool

set_flag(int, bool)

If true, enables the specified flag. Flags are optional behavior 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.

void set_flag(int flag, bool enable)

Parameters

flag int
enable bool

set_texture(int, Texture2D)

Sets the texture for the slot specified by param. See TextureParam for available slots.

void set_texture(int param, Texture2D texture)

Parameters

param int
texture Texture2D