SpatialMaterial

Inherits: Material < Resource < Reference < Object

Category: Core

Brief Description

Default 3D rendering material.

Properties

Color albedo_color Color( 1, 1, 1, 1 )
Texture albedo_texture  
float anisotropy  
bool anisotropy_enabled false
Texture anisotropy_flowmap  
bool ao_enabled false
float ao_light_affect  
bool ao_on_uv2  
Texture ao_texture  
TextureChannel ao_texture_channel  
float clearcoat  
bool clearcoat_enabled false
float clearcoat_gloss  
Texture clearcoat_texture  
bool depth_deep_parallax  
bool depth_enabled false
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 false
Texture detail_mask  
Texture detail_normal  
DetailUV detail_uv_layer  
float distance_fade_max_distance  
float distance_fade_min_distance  
DistanceFadeMode distance_fade_mode 0
Color emission  
bool emission_enabled false
float emission_energy  
bool emission_on_uv2  
EmissionOperator emission_operator  
Texture emission_texture  
bool flags_albedo_tex_force_srgb false
bool flags_disable_ambient_light false
bool flags_do_not_receive_shadows false
bool flags_ensure_correct_normals false
bool flags_fixed_size false
bool flags_no_depth_test false
bool flags_transparent false
bool flags_unshaded false
bool flags_use_point_size false
bool flags_use_shadow_to_opacity false
bool flags_vertex_lighting false
bool flags_world_triplanar false
float metallic 0.0
float metallic_specular 0.5
Texture metallic_texture  
TextureChannel metallic_texture_channel 0
bool normal_enabled false
float normal_scale  
Texture normal_texture  
float params_alpha_scissor_threshold  
bool params_billboard_keep_scale false
BillboardMode params_billboard_mode 0
BlendMode params_blend_mode 0
CullMode params_cull_mode 0
DepthDrawMode params_depth_draw_mode 0
DiffuseMode params_diffuse_mode 0
bool params_grow false
float params_grow_amount  
float params_line_width 1.0
float params_point_size 1.0
SpecularMode params_specular_mode 0
bool params_use_alpha_scissor false
int particles_anim_h_frames  
bool particles_anim_loop  
int particles_anim_v_frames  
float proximity_fade_distance  
bool proximity_fade_enable false
bool refraction_enabled false
float refraction_scale  
Texture refraction_texture  
TextureChannel refraction_texture_channel  
float rim  
bool rim_enabled false
Texture rim_texture  
float rim_tint  
float roughness 1.0
Texture roughness_texture  
TextureChannel roughness_texture_channel 0
bool subsurf_scatter_enabled false
float subsurf_scatter_strength  
Texture subsurf_scatter_texture  
Color transmission  
bool transmission_enabled false
Texture transmission_texture  
Vector3 uv1_offset Vector3( 0, 0, 0 )
Vector3 uv1_scale Vector3( 1, 1, 1 )
bool uv1_triplanar false
float uv1_triplanar_sharpness 1.0
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 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
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 )

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_USE_SHADOW_TO_OPACITY = 18
  • FLAG_MAX = 19 — 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 — Billboard mode is disabled.
  • 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

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

Setter set_anisotropy(value)
Getter get_anisotropy()

The strength of the anisotropy effect.


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


Setter set_texture(value)
Getter get_texture()

Default false
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
Default false
Setter set_feature(value)
Getter get_feature()

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


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


  • 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
Default false
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()

Default 0
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
Default false
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
Default false
Setter set_flag(value)
Getter get_flag()

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

If true, the object receives no ambient light.


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

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


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

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

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


  • bool flags_no_depth_test
Default false
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
Default false
Setter set_feature(value)
Getter get_feature()

If true, transparency is enabled on the body. See also params_blend_mode.


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

If true, the object is unaffected by lighting.


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


  • bool flags_use_shadow_to_opacity
Default false
Setter set_flag(value)
Getter get_flag()

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


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

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


  • float metallic_specular
Default 0.5
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()

Default 0
Setter set_metallic_texture_channel(value)
Getter get_metallic_texture_channel()

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

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

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

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.


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

Grows object vertices in the direction of their normals.


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

  • float params_point_size
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.


  • bool params_use_alpha_scissor
Default false
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 sprite sheet. Only enabled when using 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 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 sprite sheet. Only enabled when using 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
Default false
Setter set_proximity_fade(value)
Getter is_proximity_fade_enabled()

If true, the proximity and distance fade effect is enabled.


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

Setter set_refraction_texture_channel(value)
Getter get_refraction_texture_channel()

Setter set_rim(value)
Getter get_rim()

Default false
Setter set_feature(value)
Getter get_feature()

If true, rim effect is enabled.


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.


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

Default 0
Setter set_roughness_texture_channel(value)
Getter get_roughness_texture_channel()

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


  • 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
Default false
Setter set_feature(value)
Getter get_feature()

If true, the transmission effect is enabled.


Setter set_texture(value)
Getter get_texture()

Default Vector3( 0, 0, 0 )
Setter set_uv1_offset(value)
Getter get_uv1_offset()

Default Vector3( 1, 1, 1 )
Setter set_uv1_scale(value)
Getter get_uv1_scale()

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

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

Default Vector3( 0, 0, 0 )
Setter set_uv2_offset(value)
Getter get_uv2_offset()

Default Vector3( 1, 1, 1 )
Setter set_uv2_scale(value)
Getter get_uv2_scale()

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

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

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

If true, the model’s vertex colors are processed as sRGB mode.


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

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

Method Descriptions