Up to date

This page is up to date for Godot 4.1. If you still find outdated information, please open an issue.

BaseMaterial3D

Inherits: Material < Resource < RefCounted < Object

Inherited By: ORMMaterial3D, StandardMaterial3D

Default 3D rendering material.

Description

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.

Tutorials

Properties

Color

albedo_color

Color(1, 1, 1, 1)

Texture2D

albedo_texture

bool

albedo_texture_force_srgb

false

bool

albedo_texture_msdf

false

float

alpha_antialiasing_edge

AlphaAntiAliasing

alpha_antialiasing_mode

float

alpha_hash_scale

float

alpha_scissor_threshold

float

anisotropy

0.0

bool

anisotropy_enabled

false

Texture2D

anisotropy_flowmap

bool

ao_enabled

false

float

ao_light_affect

0.0

bool

ao_on_uv2

false

Texture2D

ao_texture

TextureChannel

ao_texture_channel

0

Color

backlight

Color(0, 0, 0, 1)

bool

backlight_enabled

false

Texture2D

backlight_texture

bool

billboard_keep_scale

false

BillboardMode

billboard_mode

0

BlendMode

blend_mode

0

float

clearcoat

1.0

bool

clearcoat_enabled

false

float

clearcoat_roughness

0.5

Texture2D

clearcoat_texture

CullMode

cull_mode

0

DepthDrawMode

depth_draw_mode

0

Texture2D

detail_albedo

BlendMode

detail_blend_mode

0

bool

detail_enabled

false

Texture2D

detail_mask

Texture2D

detail_normal

DetailUV

detail_uv_layer

0

DiffuseMode

diffuse_mode

0

bool

disable_ambient_light

false

bool

disable_receive_shadows

false

float

distance_fade_max_distance

10.0

float

distance_fade_min_distance

0.0

DistanceFadeMode

distance_fade_mode

0

Color

emission

Color(0, 0, 0, 1)

bool

emission_enabled

false

float

emission_energy_multiplier

1.0

float

emission_intensity

bool

emission_on_uv2

false

EmissionOperator

emission_operator

0

Texture2D

emission_texture

bool

fixed_size

false

bool

grow

false

float

grow_amount

0.0

bool

heightmap_deep_parallax

false

bool

heightmap_enabled

false

bool

heightmap_flip_binormal

false

bool

heightmap_flip_tangent

false

bool

heightmap_flip_texture

false

int

heightmap_max_layers

int

heightmap_min_layers

float

heightmap_scale

5.0

Texture2D

heightmap_texture

float

metallic

0.0

float

metallic_specular

0.5

Texture2D

metallic_texture

TextureChannel

metallic_texture_channel

0

float

msdf_outline_size

0.0

float

msdf_pixel_range

4.0

bool

no_depth_test

false

bool

normal_enabled

false

float

normal_scale

1.0

Texture2D

normal_texture

Texture2D

orm_texture

int

particles_anim_h_frames

bool

particles_anim_loop

int

particles_anim_v_frames

float

point_size

1.0

float

proximity_fade_distance

1.0

bool

proximity_fade_enabled

false

bool

refraction_enabled

false

float

refraction_scale

0.05

Texture2D

refraction_texture

TextureChannel

refraction_texture_channel

0

float

rim

1.0

bool

rim_enabled

false

Texture2D

rim_texture

float

rim_tint

0.5

float

roughness

1.0

Texture2D

roughness_texture

TextureChannel

roughness_texture_channel

0

ShadingMode

shading_mode

1

bool

shadow_to_opacity

false

SpecularMode

specular_mode

0

bool

subsurf_scatter_enabled

false

bool

subsurf_scatter_skin_mode

false

float

subsurf_scatter_strength

0.0

Texture2D

subsurf_scatter_texture

float

subsurf_scatter_transmittance_boost

0.0

Color

subsurf_scatter_transmittance_color

Color(1, 1, 1, 1)

float

subsurf_scatter_transmittance_depth

0.1

bool

subsurf_scatter_transmittance_enabled

false

Texture2D

subsurf_scatter_transmittance_texture

TextureFilter

texture_filter

3

bool

texture_repeat

true

Transparency

transparency

0

bool

use_particle_trails

false

bool

use_point_size

false

Vector3

uv1_offset

Vector3(0, 0, 0)

Vector3

uv1_scale

Vector3(1, 1, 1)

bool

uv1_triplanar

false

float

uv1_triplanar_sharpness

1.0

bool

uv1_world_triplanar

false

Vector3

uv2_offset

Vector3(0, 0, 0)

Vector3

uv2_scale

Vector3(1, 1, 1)

bool

uv2_triplanar

false

float

uv2_triplanar_sharpness

1.0

bool

uv2_world_triplanar

false

bool

vertex_color_is_srgb

false

bool

vertex_color_use_as_albedo

false

Methods

bool

get_feature ( Feature feature ) const

bool

get_flag ( Flags flag ) const

Texture2D

get_texture ( TextureParam param ) const

void

set_feature ( Feature feature, bool enable )

void

set_flag ( Flags flag, bool enable )

void

set_texture ( TextureParam param, Texture2D texture )


Enumerations

enum TextureParam:

TextureParam TEXTURE_ALBEDO = 0

Texture specifying per-pixel color.

TextureParam TEXTURE_METALLIC = 1

Texture specifying per-pixel metallic value.

TextureParam TEXTURE_ROUGHNESS = 2

Texture specifying per-pixel roughness value.

TextureParam TEXTURE_EMISSION = 3

Texture specifying per-pixel emission color.

TextureParam TEXTURE_NORMAL = 4

Texture specifying per-pixel normal vector.

TextureParam TEXTURE_RIM = 5

Texture specifying per-pixel rim value.

TextureParam TEXTURE_CLEARCOAT = 6

Texture specifying per-pixel clearcoat value.

TextureParam TEXTURE_FLOWMAP = 7

Texture specifying per-pixel flowmap direction for use with anisotropy.

TextureParam TEXTURE_AMBIENT_OCCLUSION = 8

Texture specifying per-pixel ambient occlusion value.

TextureParam TEXTURE_HEIGHTMAP = 9

Texture specifying per-pixel height.

TextureParam TEXTURE_SUBSURFACE_SCATTERING = 10

Texture specifying per-pixel subsurface scattering.

TextureParam TEXTURE_SUBSURFACE_TRANSMITTANCE = 11

Texture specifying per-pixel transmittance for subsurface scattering.

TextureParam TEXTURE_BACKLIGHT = 12

Texture specifying per-pixel backlight color.

TextureParam TEXTURE_REFRACTION = 13

Texture specifying per-pixel refraction strength.

TextureParam TEXTURE_DETAIL_MASK = 14

Texture specifying per-pixel detail mask blending value.

TextureParam TEXTURE_DETAIL_ALBEDO = 15

Texture specifying per-pixel detail color.

TextureParam TEXTURE_DETAIL_NORMAL = 16

Texture specifying per-pixel detail normal.

TextureParam TEXTURE_ORM = 17

Texture holding ambient occlusion, roughness, and metallic.

TextureParam TEXTURE_MAX = 18

Represents the size of the TextureParam enum.


enum TextureFilter:

TextureFilter TEXTURE_FILTER_NEAREST = 0

The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized.

TextureFilter TEXTURE_FILTER_LINEAR = 1

The texture filter blends between the nearest 4 pixels. Use this when you want to avoid a pixelated style, but do not want mipmaps.

TextureFilter TEXTURE_FILTER_NEAREST_WITH_MIPMAPS = 2

The texture filter reads from the nearest pixel in the nearest mipmap. The fastest way to read from textures with mipmaps.

TextureFilter TEXTURE_FILTER_LINEAR_WITH_MIPMAPS = 3

The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps. Use this for most cases as mipmaps are important to smooth out pixels that are far from the camera.

TextureFilter TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC = 4

The texture filter reads from the nearest pixel, but selects a mipmap based on the angle between the surface and the camera view. This reduces artifacts on surfaces that are almost in line with the camera. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level.

TextureFilter TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC = 5

The texture filter blends between the nearest 4 pixels and selects a mipmap based on the angle between the surface and the camera view. This reduces artifacts on surfaces that are almost in line with the camera. This is the slowest of the filtering options, but results in the highest quality texturing. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level.

TextureFilter TEXTURE_FILTER_MAX = 6

Represents the size of the TextureFilter enum.


enum DetailUV:

DetailUV DETAIL_UV_1 = 0

Use UV with the detail texture.

DetailUV DETAIL_UV_2 = 1

Use UV2 with the detail texture.


enum Transparency:

Transparency TRANSPARENCY_DISABLED = 0

The material will not use transparency. This is the fastest to render.

Transparency TRANSPARENCY_ALPHA = 1

The material will use the texture's alpha values for transparency. This is the slowest to render, and disables shadow casting.

Transparency TRANSPARENCY_ALPHA_SCISSOR = 2

The material will cut off all values below a threshold, the rest will remain opaque. The opaque portions will be rendered in the depth prepass. This is faster to render than alpha blending, but slower than opaque rendering. This also supports casting shadows.