SpatialMaterial

Inherits: Material < Resource < Reference < Object

Category: Core

Brief Description

Default 3D rendering material.

Properties

Color albedo_color
Texture albedo_texture
float anisotropy
bool anisotropy_enabled
Texture anisotropy_flowmap
bool ao_enabled
float ao_light_affect
bool ao_on_uv2
Texture ao_texture
TextureChannel ao_texture_channel
float clearcoat
bool clearcoat_enabled
float clearcoat_gloss
Texture clearcoat_texture
bool depth_deep_parallax
bool depth_enabled
bool depth_flip_binormal
bool depth_flip_tangent
int depth_max_layers
int depth_min_layers
float depth_scale
Texture depth_texture
Texture detail_albedo
BlendMode detail_blend_mode
bool detail_enabled
Texture detail_mask
Texture detail_normal
DetailUV detail_uv_layer
float distance_fade_max_distance
float distance_fade_min_distance
DistanceFadeMode distance_fade_mode
Color emission
bool emission_enabled
float emission_energy
bool emission_on_uv2
EmissionOperator emission_operator
Texture emission_texture
bool flags_albedo_tex_force_srgb
bool flags_disable_ambient_light
bool flags_do_not_receive_shadows
bool flags_ensure_correct_normals
bool flags_fixed_size
bool flags_no_depth_test
bool flags_transparent
bool flags_unshaded
bool flags_use_point_size
bool flags_vertex_lighting
bool flags_world_triplanar
float metallic
float metallic_specular
Texture metallic_texture
TextureChannel metallic_texture_channel
bool normal_enabled
float normal_scale
Texture normal_texture
float params_alpha_scissor_threshold
bool params_billboard_keep_scale
BillboardMode params_billboard_mode
BlendMode params_blend_mode
CullMode params_cull_mode
DepthDrawMode params_depth_draw_mode
DiffuseMode params_diffuse_mode
bool params_grow
float params_grow_amount
float params_line_width
float params_point_size
SpecularMode params_specular_mode
bool params_use_alpha_scissor
int particles_anim_h_frames
bool particles_anim_loop
int particles_anim_v_frames
float proximity_fade_distance
bool proximity_fade_enable
bool refraction_enabled
float refraction_scale
Texture refraction_texture
TextureChannel refraction_texture_channel
float rim
bool rim_enabled
Texture rim_texture
float rim_tint
float roughness
Texture roughness_texture
TextureChannel roughness_texture_channel
bool subsurf_scatter_enabled
float subsurf_scatter_strength
Texture subsurf_scatter_texture
Color transmission
bool transmission_enabled
Texture transmission_texture
Vector3 uv1_offset
Vector3 uv1_scale
bool uv1_triplanar
float uv1_triplanar_sharpness
Vector3 uv2_offset
Vector3 uv2_scale
bool uv2_triplanar
float uv2_triplanar_sharpness
bool vertex_color_is_srgb
bool vertex_color_use_as_albedo

Enumerations

enum TextureParam:

  • TEXTURE_ALBEDO = 0
  • TEXTURE_METALLIC = 1
  • TEXTURE_ROUGHNESS = 2
  • TEXTURE_EMISSION = 3
  • TEXTURE_NORMAL = 4
  • TEXTURE_RIM = 5
  • TEXTURE_CLEARCOAT = 6
  • TEXTURE_FLOWMAP = 7
  • TEXTURE_AMBIENT_OCCLUSION = 8
  • TEXTURE_DEPTH = 9
  • TEXTURE_SUBSURFACE_SCATTERING = 10
  • TEXTURE_TRANSMISSION = 11
  • TEXTURE_REFRACTION = 12
  • TEXTURE_DETAIL_MASK = 13
  • TEXTURE_DETAIL_ALBEDO = 14
  • TEXTURE_DETAIL_NORMAL = 15
  • TEXTURE_MAX = 16 — Represents the size of the TextureParam enum.

enum DetailUV:

  • DETAIL_UV_1 = 0
  • DETAIL_UV_2 = 1

enum Feature:

  • FEATURE_TRANSPARENT = 0
  • FEATURE_EMISSION = 1
  • FEATURE_NORMAL_MAPPING = 2
  • FEATURE_RIM = 3
  • FEATURE_CLEARCOAT = 4
  • FEATURE_ANISOTROPY = 5
  • FEATURE_AMBIENT_OCCLUSION = 6
  • FEATURE_DEPTH_MAPPING = 7
  • FEATURE_SUBSURACE_SCATTERING = 8
  • FEATURE_TRANSMISSION = 9
  • FEATURE_REFRACTION = 10
  • FEATURE_DETAIL = 11
  • FEATURE_MAX = 12 — Represents the size of the Feature enum.

enum BlendMode:

  • BLEND_MODE_MIX = 0 — Default blend mode.
  • BLEND_MODE_ADD = 1
  • BLEND_MODE_SUB = 2
  • BLEND_MODE_MUL = 3

enum DepthDrawMode:

  • DEPTH_DRAW_OPAQUE_ONLY = 0 — Default depth draw mode. Depth is drawn only for opaque objects.
  • DEPTH_DRAW_ALWAYS = 1 — Depth draw is calculated for both opaque and transparent objects.
  • DEPTH_DRAW_DISABLED = 2 — No depth draw.
  • DEPTH_DRAW_ALPHA_OPAQUE_PREPASS = 3 — For transparent objects, an opaque pass is made first with the opaque parts, then transparency is drawn.

enum CullMode:

  • CULL_BACK = 0 — Default cull mode. The back of the object is culled when not visible.
  • CULL_FRONT = 1 — The front of the object is culled when not visible.
  • CULL_DISABLED = 2 — No culling is performed.

enum Flags:

  • FLAG_UNSHADED = 0
  • FLAG_USE_VERTEX_LIGHTING = 1
  • FLAG_DISABLE_DEPTH_TEST = 2
  • FLAG_ALBEDO_FROM_VERTEX_COLOR = 3
  • FLAG_SRGB_VERTEX_COLOR = 4
  • FLAG_USE_POINT_SIZE = 5
  • FLAG_FIXED_SIZE = 6
  • FLAG_BILLBOARD_KEEP_SCALE = 7
  • FLAG_UV1_USE_TRIPLANAR = 8
  • FLAG_UV2_USE_TRIPLANAR = 9
  • FLAG_AO_ON_UV2 = 11
  • FLAG_EMISSION_ON_UV2 = 12
  • FLAG_USE_ALPHA_SCISSOR = 13
  • FLAG_TRIPLANAR_USE_WORLD = 10
  • FLAG_ALBEDO_TEXTURE_FORCE_SRGB = 14
  • FLAG_DONT_RECEIVE_SHADOWS = 15
  • FLAG_DISABLE_AMBIENT_LIGHT = 17
  • FLAG_ENSURE_CORRECT_NORMALS = 16
  • FLAG_MAX = 18 — Represents the size of the Flags enum.

enum DiffuseMode:

  • DIFFUSE_BURLEY = 0 — Default diffuse scattering algorithm.
  • DIFFUSE_LAMBERT = 1 — Diffuse scattering ignores roughness.
  • DIFFUSE_LAMBERT_WRAP = 2 — Extends Lambert to cover more than 90 degrees when roughness increases.
  • DIFFUSE_OREN_NAYAR = 3 — Attempts to use roughness to emulate microsurfacing.
  • DIFFUSE_TOON = 4 — Uses a hard cut for lighting, with smoothing affected by roughness.

enum SpecularMode:

  • SPECULAR_SCHLICK_GGX = 0 — Default specular blob.
  • SPECULAR_BLINN = 1 — Older specular algorithm, included for compatibility.
  • SPECULAR_PHONG = 2 — Older specular algorithm, included for compatibility.
  • SPECULAR_TOON = 3 — Toon blob which changes size based on roughness.
  • SPECULAR_DISABLED = 4 — No specular blob.

enum BillboardMode:

  • BILLBOARD_DISABLED = 0 — Default value.
  • BILLBOARD_ENABLED = 1 — The object’s z-axis will always face the camera.
  • BILLBOARD_FIXED_Y = 2 — The object’s x-axis will always face the camera.
  • BILLBOARD_PARTICLES = 3 — Used for particle systems. Enables particle animation options.

enum TextureChannel:

  • TEXTURE_CHANNEL_RED = 0
  • TEXTURE_CHANNEL_GREEN = 1
  • TEXTURE_CHANNEL_BLUE = 2
  • TEXTURE_CHANNEL_ALPHA = 3
  • TEXTURE_CHANNEL_GRAYSCALE = 4

enum EmissionOperator:

  • EMISSION_OP_ADD = 0
  • EMISSION_OP_MULTIPLY = 1

enum DistanceFadeMode:

  • DISTANCE_FADE_DISABLED = 0
  • DISTANCE_FADE_PIXEL_ALPHA = 1
  • DISTANCE_FADE_PIXEL_DITHER = 2
  • DISTANCE_FADE_OBJECT_DITHER = 3

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

Property Descriptions

Setter set_albedo(value)
Getter get_albedo()

The material’s base color.


Setter set_texture(value)
Getter get_texture()

Setter set_anisotropy(value)
Getter get_anisotropy()

The strength of the anisotropy effect.


  • bool anisotropy_enabled
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. Default value: false.


Setter set_texture(value)
Getter get_texture()

Setter set_feature(value)
Getter get_feature()

If true, ambient occlusion is enabled.


Setter set_ao_light_affect(value)
Getter get_ao_light_affect()

Setter set_flag(value)
Getter get_flag()

Setter set_texture(value)
Getter get_texture()

Setter set_ao_texture_channel(value)
Getter get_ao_texture_channel()

Setter set_clearcoat(value)
Getter get_clearcoat()

  • bool clearcoat_enabled
Setter set_feature(value)
Getter get_feature()

If true, clearcoat rendering is enabled. Adds a secondary transparent pass to the material. Default value: false.


Setter set_clearcoat_gloss(value)
Getter get_clearcoat_gloss()

Setter set_texture(value)
Getter get_texture()

  • bool depth_deep_parallax
Setter set_depth_deep_parallax(value)
Getter is_depth_deep_parallax_enabled()

  • bool depth_enabled
Setter set_feature(value)
Getter get_feature()

If true, Depth mapping is enabled. See also normal_enabled.


  • bool depth_flip_binormal
Setter set_depth_deep_parallax_flip_binormal(value)
Getter get_depth_deep_parallax_flip_binormal()

  • bool depth_flip_tangent
Setter set_depth_deep_parallax_flip_tangent(value)
Getter get_depth_deep_parallax_flip_tangent()

  • int depth_max_layers
Setter set_depth_deep_parallax_max_layers(value)
Getter get_depth_deep_parallax_max_layers()

  • int depth_min_layers
Setter set_depth_deep_parallax_min_layers(value)
Getter get_depth_deep_parallax_min_layers()

Setter set_depth_scale(value)
Getter get_depth_scale()

Setter set_texture(value)
Getter get_texture()

Setter set_texture(value)
Getter get_texture()

Setter set_detail_blend_mode(value)
Getter get_detail_blend_mode()

  • bool detail_enabled
Setter set_feature(value)
Getter get_feature()

Setter set_texture(value)
Getter get_texture()

Setter set_texture(value)
Getter get_texture()

Setter set_detail_uv(value)
Getter get_detail_uv()

  • float distance_fade_max_distance
Setter set_distance_fade_max_distance(value)
Getter get_distance_fade_max_distance()

  • float distance_fade_min_distance
Setter set_distance_fade_min_distance(value)
Getter get_distance_fade_min_distance()

Setter set_distance_fade(value)
Getter get_distance_fade()

Setter set_emission(value)
Getter get_emission()

The emitted light’s color. See emission_enabled.


  • bool emission_enabled
Setter set_feature(value)
Getter get_feature()

If true, the body emits light.


Setter set_emission_energy(value)
Getter get_emission_energy()

The emitted light’s strength. See emission_enabled.


  • bool emission_on_uv2
Setter set_flag(value)
Getter get_flag()

Setter set_emission_operator(value)
Getter get_emission_operator()

Setter set_texture(value)
Getter get_texture()

  • bool flags_albedo_tex_force_srgb
Setter set_flag(value)
Getter get_flag()

  • bool flags_disable_ambient_light
Setter set_flag(value)
Getter get_flag()

If true, the object receives no ambient light. Default value: false.


  • bool flags_do_not_receive_shadows
Setter set_flag(value)
Getter get_flag()

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


  • bool flags_ensure_correct_normals
Setter set_flag(value)
Getter get_flag()

  • bool flags_fixed_size
Setter set_flag(value)
Getter get_flag()

If true, the object is rendered at the same size regardless of distance. Default value: false.


  • bool flags_no_depth_test
Setter set_flag(value)
Getter get_flag()

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


  • bool flags_transparent
Setter set_feature(value)
Getter get_feature()

If true, transparency is enabled on the body. Default value: false. See also params_blend_mode.


  • bool flags_unshaded
Setter set_flag(value)
Getter get_flag()

If true, the object is unaffected by lighting. Default value: false.


  • bool flags_use_point_size
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.


  • bool flags_vertex_lighting
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 value: false.


  • bool flags_world_triplanar
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 value: false.


Setter set_metallic(value)
Getter get_metallic()

The reflectivity of the object’s surface. The higher the value the more light is reflected.


  • float metallic_specular
Setter set_specular(value)
Getter get_specular()

General reflectivity amount. 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()

Setter set_metallic_texture_channel(value)
Getter get_metallic_texture_channel()

  • bool normal_enabled
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()

  • float params_alpha_scissor_threshold
Setter set_alpha_scissor_threshold(value)
Getter get_alpha_scissor_threshold()

  • bool params_billboard_keep_scale
Setter set_flag(value)
Getter get_flag()

Setter set_billboard_mode(value)
Getter get_billboard_mode()

Controls how the object faces the camera. See BillboardMode.


Setter set_blend_mode(value)
Getter get_blend_mode()

The material’s blend mode. Note that values other than Mix force the object into the transparent pipeline. See BlendMode.


Setter set_cull_mode(value)
Getter get_cull_mode()

Which side of the object is not drawn when backfaces are rendered. See CullMode.


Setter set_depth_draw_mode(value)
Getter get_depth_draw_mode()

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


Setter set_diffuse_mode(value)
Getter get_diffuse_mode()

The algorithm used for diffuse light scattering. See DiffuseMode.


Setter set_grow_enabled(value)
Getter is_grow_enabled()

If true, enables the vertex grow setting. See params_grow_amount.


  • float params_grow_amount
Setter set_grow(value)
Getter get_grow()

Grows object vertices in the direction of their normals.


  • float params_line_width
Setter set_line_width(value)
Getter get_line_width()

  • float params_point_size
Setter set_point_size(value)
Getter get_point_size()

The point size in pixels. See flags_use_point_size.


Setter set_specular_mode(value)
Getter get_specular_mode()

The method for rendering the specular blob. See SpecularMode.


  • bool params_use_alpha_scissor
Setter set_flag(value)
Getter get_flag()

  • int particles_anim_h_frames
Setter set_particles_anim_h_frames(value)
Getter get_particles_anim_h_frames()

The number of horizontal frames in the particle spritesheet. Only enabled when using BillboardMode.BILLBOARD_PARTICLES. See params_billboard_mode.


  • bool particles_anim_loop
Setter set_particles_anim_loop(value)
Getter get_particles_anim_loop()

If true, particle animations are looped. Only enabled when using BillboardMode.BILLBOARD_PARTICLES. See params_billboard_mode.


  • int particles_anim_v_frames
Setter set_particles_anim_v_frames(value)
Getter get_particles_anim_v_frames()

The number of vertical frames in the particle spritesheet. Only enabled when using BillboardMode.BILLBOARD_PARTICLES. See params_billboard_mode.


  • float proximity_fade_distance
Setter set_proximity_fade_distance(value)
Getter get_proximity_fade_distance()

  • bool proximity_fade_enable
Setter set_proximity_fade(value)
Getter is_proximity_fade_enabled()

If true, the proximity and distance fade effect is enabled. Default value: false.


  • bool refraction_enabled
Setter set_feature(value)
Getter get_feature()

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


Setter set_refraction(value)
Getter get_refraction()

The strength of the refraction effect.


Setter set_texture(value)
Getter get_texture()

Setter set_refraction_texture_channel(value)
Getter get_refraction_texture_channel()

Setter set_rim(value)
Getter get_rim()

Setter set_feature(value)
Getter get_feature()

If true, rim effect is enabled. Default value: false.


Setter set_texture(value)
Getter get_texture()

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.


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()

Setter set_roughness_texture_channel(value)
Getter get_roughness_texture_channel()

  • bool subsurf_scatter_enabled
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.


  • float subsurf_scatter_strength
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()

Setter set_transmission(value)
Getter get_transmission()

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


  • bool transmission_enabled
Setter set_feature(value)
Getter get_feature()

If true, the transmission effect is enabled. Default value: false.


Setter set_texture(value)
Getter get_texture()

Setter set_uv1_offset(value)
Getter get_uv1_offset()

Setter set_uv1_scale(value)
Getter get_uv1_scale()

  • bool uv1_triplanar
Setter set_flag(value)
Getter get_flag()

  • float uv1_triplanar_sharpness
Setter set_uv1_triplanar_blend_sharpness(value)
Getter get_uv1_triplanar_blend_sharpness()

Setter set_uv2_offset(value)
Getter get_uv2_offset()

Setter set_uv2_scale(value)
Getter get_uv2_scale()

  • bool uv2_triplanar
Setter set_flag(value)
Getter get_flag()

  • float uv2_triplanar_sharpness
Setter set_uv2_triplanar_blend_sharpness(value)
Getter get_uv2_triplanar_blend_sharpness()

  • bool vertex_color_is_srgb
Setter set_flag(value)
Getter get_flag()

If true, the model’s vertex colors are processed as sRGB mode. Default value: false.


  • bool vertex_color_use_as_albedo
Setter set_flag(value)
Getter get_flag()

If true, the vertex color is used as albedo color. Default value: false.