SpatialMaterial

Inherits: Material < Resource < Reference < Object

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

Coloralbedo_colorColor( 1, 1, 1, 1 )
Texturealbedo_texture 
floatanisotropy 
boolanisotropy_enabledfalse
Textureanisotropy_flowmap 
boolao_enabledfalse
floatao_light_affect 
boolao_on_uv2 
Textureao_texture 
TextureChannelao_texture_channel 
floatclearcoat 
boolclearcoat_enabledfalse
floatclearcoat_gloss 
Textureclearcoat_texture 
booldepth_deep_parallax 
booldepth_enabledfalse
booldepth_flip_binormal 
booldepth_flip_tangent 
intdepth_max_layers 
intdepth_min_layers 
floatdepth_scale 
Texturedepth_texture 
Texturedetail_albedo 
BlendModedetail_blend_mode 
booldetail_enabledfalse
Texturedetail_mask 
Texturedetail_normal 
DetailUVdetail_uv_layer 
floatdistance_fade_max_distance 
floatdistance_fade_min_distance 
DistanceFadeModedistance_fade_mode0
Coloremission 
boolemission_enabledfalse
floatemission_energy 
boolemission_on_uv2 
EmissionOperatoremission_operator 
Textureemission_texture 
boolflags_albedo_tex_force_srgbfalse
boolflags_disable_ambient_lightfalse
boolflags_do_not_receive_shadowsfalse
boolflags_ensure_correct_normalsfalse
boolflags_fixed_sizefalse
boolflags_no_depth_testfalse
boolflags_transparentfalse
boolflags_unshadedfalse
boolflags_use_point_sizefalse
boolflags_use_shadow_to_opacityfalse
boolflags_vertex_lightingfalse
boolflags_world_triplanarfalse
floatmetallic0.0
floatmetallic_specular0.5
Texturemetallic_texture 
TextureChannelmetallic_texture_channel0
boolnormal_enabledfalse
floatnormal_scale 
Texturenormal_texture 
floatparams_alpha_scissor_threshold 
boolparams_billboard_keep_scalefalse
BillboardModeparams_billboard_mode0
BlendModeparams_blend_mode0
CullModeparams_cull_mode0
DepthDrawModeparams_depth_draw_mode0
DiffuseModeparams_diffuse_mode0
boolparams_growfalse
floatparams_grow_amount 
floatparams_line_width1.0
floatparams_point_size1.0
SpecularModeparams_specular_mode0
boolparams_use_alpha_scissorfalse
intparticles_anim_h_frames 
boolparticles_anim_loop 
intparticles_anim_v_frames 
floatproximity_fade_distance 
boolproximity_fade_enablefalse
boolrefraction_enabledfalse
floatrefraction_scale 
Texturerefraction_texture 
TextureChannelrefraction_texture_channel 
floatrim 
boolrim_enabledfalse
Texturerim_texture 
floatrim_tint 
floatroughness1.0
Textureroughness_texture 
TextureChannelroughness_texture_channel0
boolsubsurf_scatter_enabledfalse
floatsubsurf_scatter_strength 
Texturesubsurf_scatter_texture 
Colortransmission 
booltransmission_enabledfalse
Texturetransmission_texture 
Vector3uv1_offsetVector3( 0, 0, 0 )
Vector3uv1_scaleVector3( 1, 1, 1 )
booluv1_triplanarfalse
floatuv1_triplanar_sharpness1.0
Vector3uv2_offsetVector3( 0, 0, 0 )
Vector3uv2_scaleVector3( 1, 1, 1 )
booluv2_triplanarfalse
floatuv2_triplanar_sharpness1.0
boolvertex_color_is_srgbfalse
boolvertex_color_use_as_albedofalse

Methods

boolget_feature ( Feature feature ) const
boolget_flag ( Flags flag ) const
Textureget_texture ( TextureParam param ) const
voidset_feature ( Feature feature, bool enable )
voidset_flag ( Flags flag, bool enable )
voidset_texture ( TextureParam param, Texture texture )

Enumerations

enum TextureParam:

  • TEXTURE_ALBEDO = 0 —- Texture specifying per-pixel color.
  • TEXTURE_METALLIC = 1 —- Texture specifying per-pixel metallic value.
  • TEXTURE_ROUGHNESS = 2 —- Texture specifying per-pixel roughness value.
  • TEXTURE_EMISSION = 3 —- Texture specifying per-pixel emission color.
  • TEXTURE_NORMAL = 4 —- Texture specifying per-pixel normal vector.
  • TEXTURE_RIM = 5 —- Texture specifying per-pixel rim value.
  • TEXTURE_CLEARCOAT = 6 —- Texture specifying per-pixel clearcoat value.
  • TEXTURE_FLOWMAP = 7 —- Texture specifying per-pixel flowmap direction for use with anisotropy.
  • TEXTURE_AMBIENT_OCCLUSION = 8 —- Texture specifying per-pixel ambient occlusion value.
  • TEXTURE_DEPTH = 9 —- Texture specifying per-pixel depth.
  • TEXTURE_SUBSURFACE_SCATTERING = 10 —- Texture specifying per-pixel subsurface scattering.
  • TEXTURE_TRANSMISSION = 11 —- Texture specifying per-pixel transmission color.
  • TEXTURE_REFRACTION = 12 —- Texture specifying per-pixel refraction strength.
  • TEXTURE_DETAIL_MASK = 13 —- Texture specifying per-pixel detail mask blending value.
  • TEXTURE_DETAIL_ALBEDO = 14 —- Texture specifying per-pixel detail color.
  • TEXTURE_DETAIL_NORMAL = 15 —- Texture specifying per-pixel detail normal.
  • TEXTURE_MAX = 16 —- Represents the size of the TextureParam enum.

enum DetailUV:

  • DETAIL_UV_1 = 0 —- Use UV with the detail texture.
  • DETAIL_UV_2 = 1 —- Use UV2 with the detail texture.

enum Feature:


enum BlendMode:

  • BLEND_MODE_MIX = 0 —- Default blend mode. The color of the object is blended over the background based on the object’s alpha value.
  • BLEND_MODE_ADD = 1 —- The color of the object is added to the background.
  • BLEND_MODE_SUB = 2 —- The color of the object is subtracted from the background.
  • BLEND_MODE_MUL = 3 —- The color of the object is multiplied by the background.

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 —- No lighting is used on the object. Color comes directly from ALBEDO.
  • FLAG_USE_VERTEX_LIGHTING = 1 —- Lighting is calculated per-vertex rather than per-pixel. This can be used to increase the speed of the shader at the cost of quality.
  • FLAG_DISABLE_DEPTH_TEST = 2 —- Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
  • FLAG_ALBEDO_FROM_VERTEX_COLOR = 3 —- Set ALBEDO to the per-vertex color specified in the mesh.
  • FLAG_SRGB_VERTEX_COLOR = 4 —- Vertex color is in sRGB space and needs to be converted to linear. Only applies in the GLES3 renderer.
  • FLAG_USE_POINT_SIZE = 5 —- Uses point size to alter the size of primitive points. Also changes the albedo texture lookup to use POINT_COORD instead of UV.
  • FLAG_FIXED_SIZE = 6 —- Object is scaled by depth so that it always appears the same size on screen.
  • FLAG_BILLBOARD_KEEP_SCALE = 7 —- 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.
  • FLAG_UV1_USE_TRIPLANAR = 8 —- Use triplanar texture lookup for all texture lookups that would normally use UV.
  • FLAG_UV2_USE_TRIPLANAR = 9 —- Use triplanar texture lookup for all texture lookups that would normally use UV2.
  • FLAG_AO_ON_UV2 = 11 —- Use UV2 coordinates to look up from the ao_texture.
  • FLAG_EMISSION_ON_UV2 = 12 —- Use UV2 coordinates to look up from the emission_texture.
  • FLAG_USE_ALPHA_SCISSOR = 13 —- Use alpha scissor. Set by params_use_alpha_scissor.
  • FLAG_TRIPLANAR_USE_WORLD = 10 —- Use world coordinates in the triplanar texture lookup instead of local coordinates.
  • FLAG_ALBEDO_TEXTURE_FORCE_SRGB = 14 —- Forces the shader to convert albedo from sRGB space to linear space.
  • FLAG_DONT_RECEIVE_SHADOWS = 15 —- Disables receiving shadows from other objects.
  • FLAG_DISABLE_AMBIENT_LIGHT = 17 —- Disables receiving ambient light.
  • FLAG_ENSURE_CORRECT_NORMALS = 16 —- Ensures that normals appear correct, even with non-uniform scaling.
  • FLAG_USE_SHADOW_TO_OPACITY = 18 —- Enables the shadow to opacity feature.
  • 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 when assigned to Particles and CPUParticles nodes. Enables 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:

  • TEXTURE_CHANNEL_RED = 0 —- Used to read from the red channel of a texture.
  • TEXTURE_CHANNEL_GREEN = 1 —- Used to read from the green channel of a texture.
  • TEXTURE_CHANNEL_BLUE = 2 —- Used to read from the blue channel of a texture.
  • TEXTURE_CHANNEL_ALPHA = 3 —- Used to read from the alpha channel of a texture.
  • TEXTURE_CHANNEL_GRAYSCALE = 4 —- Currently unused.

enum EmissionOperator:

  • EMISSION_OP_ADD = 0 —- Adds the emission color to the color from the emission texture.
  • EMISSION_OP_MULTIPLY = 1 —- Multiplies the emission color by the color from the emission texture.

enum DistanceFadeMode:

  • DISTANCE_FADE_DISABLED = 0 —- Do not use distance fade.
  • DISTANCE_FADE_PIXEL_ALPHA = 1 —- Smoothly fades the object out based on each pixel’s distance from the camera using the alpha channel.
  • DISTANCE_FADE_PIXEL_DITHER = 2 —- Smoothly fades the object out based on each pixel’s distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than DISTANCE_FADE_PIXEL_ALPHA.
  • DISTANCE_FADE_OBJECT_DITHER = 3 —- Smoothly fades the object out based on the object’s distance from the camera using a dither approach. Dithering discards pixels based on a set pattern to smoothly fade without enabling transparency. On certain hardware this can be faster than DISTANCE_FADE_PIXEL_ALPHA.

Property Descriptions

DefaultColor( 1, 1, 1, 1 )
Setterset_albedo(value)
Getterget_albedo()

The material’s base color.


Setterset_texture(value)
Getterget_texture()

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


Setterset_anisotropy(value)
Getterget_anisotropy()

The strength of the anisotropy effect.


  • bool anisotropy_enabled
Defaultfalse
Setterset_feature(value)
Getterget_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.


Setterset_texture(value)
Getterget_texture()

Texture that offsets the tangent map for anisotropy calculations.


Defaultfalse
Setterset_feature(value)
Getterget_feature()

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


Setterset_ao_light_affect(value)
Getterget_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.


Setterset_flag(value)
Getterget_flag()

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


Setterset_texture(value)
Getterget_texture()

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


Setterset_ao_texture_channel(value)
Getterget_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.


Setterset_clearcoat(value)
Getterget_clearcoat()

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


  • bool clearcoat_enabled
Defaultfalse
Setterset_feature(value)
Getterget_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.


Setterset_clearcoat_gloss(value)
Getterget_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.


Setterset_texture(value)
Getterget_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.


  • bool depth_deep_parallax
Setterset_depth_deep_parallax(value)
Getteris_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.


Defaultfalse
Setterset_feature(value)
Getterget_feature()

If true, depth mapping is enabled (also called “parallax mapping” or “height mapping”). See also normal_enabled.


  • bool depth_flip_binormal
Setterset_depth_deep_parallax_flip_binormal(value)
Getterget_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.


  • bool depth_flip_tangent
Setterset_depth_deep_parallax_flip_tangent(value)
Getterget_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.


  • int depth_max_layers
Setterset_depth_deep_parallax_max_layers(value)
Getterget_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.


  • int depth_min_layers
Setterset_depth_deep_parallax_min_layers(value)
Getterget_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.


Setterset_depth_scale(value)
Getterget_depth_scale()

Scales the depth offset effect. A higher number will create a larger depth.


Setterset_texture(value)
Getterget_texture()

Texture used to determine depth at a given pixel. Depth is always stored in the red channel.


Setterset_texture(value)
Getterget_texture()

Texture that specifies the color of the detail overlay.


Setterset_detail_blend_mode(value)
Getterget_detail_blend_mode()

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


  • bool detail_enabled
Defaultfalse
Setterset_feature(value)
Getterget_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.


Setterset_texture(value)
Getterget_texture()

Texture used to specify how the detail textures get blended with the base textures.


Setterset_texture(value)
Getterget_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.


Setterset_detail_uv(value)
Getterget_detail_uv()

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


  • float distance_fade_max_distance
Setterset_distance_fade_max_distance(value)
Getterget_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.


  • float distance_fade_min_distance
Setterset_distance_fade_min_distance(value)
Getterget_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.


Default0
Setterset_distance_fade(value)
Getterget_distance_fade()

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


Setterset_emission(value)
Getterget_emission()

The emitted light’s color. See emission_enabled.


  • bool emission_enabled
Defaultfalse
Setterset_feature(value)
Getterget_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.


Setterset_emission_energy(value)
Getterget_emission_energy()

The emitted light’s strength. See emission_enabled.


  • bool emission_on_uv2
Setterset_flag(value)
Getterget_flag()

Use UV2 to read from the emission_texture.


Setterset_emission_operator(value)
Getterget_emission_operator()

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


Setterset_texture(value)
Getterget_texture()

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


  • bool flags_albedo_tex_force_srgb
Defaultfalse
Setterset_flag(value)
Getterget_flag()

Forces a conversion of the albedo_texture from sRGB space to linear space.


  • bool flags_disable_ambient_light
Defaultfalse
Setterset_flag(value)
Getterget_flag()

If true, the object receives no ambient light.


  • bool flags_do_not_receive_shadows
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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


  • bool flags_ensure_correct_normals
Defaultfalse
Setterset_flag(value)
Getterget_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.


  • bool flags_fixed_size
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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


  • bool flags_no_depth_test
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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


  • bool flags_transparent
Defaultfalse
Setterset_feature(value)
Getterget_feature()

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


  • bool flags_unshaded
Defaultfalse
Setterset_flag(value)
Getterget_flag()

If true, the object is unaffected by lighting.


  • bool flags_use_point_size
Defaultfalse
Setterset_flag(value)
Getterget_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
Defaultfalse
Setterset_flag(value)
Getterget_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.


  • bool flags_vertex_lighting
Defaultfalse
Setterset_flag(value)
Getterget_flag()

If true, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices.


  • bool flags_world_triplanar
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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


Default0.0
Setterset_metallic(value)
Getterget_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.


Default0.5
Setterset_specular(value)
Getterget_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.


Setterset_texture(value)
Getterget_texture()

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


Default0
Setterset_metallic_texture_channel(value)
Getterget_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.


  • bool normal_enabled
Defaultfalse
Setterset_feature(value)
Getterget_feature()

If true, normal mapping is enabled.


Setterset_normal_scale(value)
Getterget_normal_scale()

The strength of the normal map’s effect.


Setterset_texture(value)
Getterget_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.


  • float params_alpha_scissor_threshold
Setterset_alpha_scissor_threshold(value)
Getterget_alpha_scissor_threshold()

Threshold at which the alpha scissor will discard values.


  • bool params_billboard_keep_scale
Defaultfalse
Setterset_flag(value)
Getterget_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.


Default0
Setterset_billboard_mode(value)
Getterget_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.


Default0
Setterset_blend_mode(value)
Getterget_blend_mode()

The material’s blend mode.

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


Default0
Setterset_cull_mode(value)
Getterget_cull_mode()

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


Default0
Setterset_depth_draw_mode(value)
Getterget_depth_draw_mode()

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


Default0
Setterset_diffuse_mode(value)
Getterget_diffuse_mode()

The algorithm used for diffuse light scattering. See DiffuseMode.


Defaultfalse
Setterset_grow_enabled(value)
Getteris_grow_enabled()

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


  • float params_grow_amount
Setterset_grow(value)
Getterget_grow()

Grows object vertices in the direction of their normals.


Default1.0
Setterset_line_width(value)
Getterget_line_width()

Currently unimplemented in Godot.


Default1.0
Setterset_point_size(value)
Getterget_point_size()

The point size in pixels. See flags_use_point_size.


Default0
Setterset_specular_mode(value)
Getterget_specular_mode()

The method for rendering the specular blob. See SpecularMode.


  • bool params_use_alpha_scissor
Defaultfalse
Setterset_flag(value)
Getterget_flag()

If true, the shader will discard all pixels that have an alpha value less than params_alpha_scissor_threshold.


  • int particles_anim_h_frames
Setterset_particles_anim_h_frames(value)
Getterget_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
Setterset_particles_anim_loop(value)
Getterget_particles_anim_loop()

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


  • int particles_anim_v_frames
Setterset_particles_anim_v_frames(value)
Getterget_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
Setterset_proximity_fade_distance(value)
Getterget_proximity_fade_distance()

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


  • bool proximity_fade_enable
Defaultfalse
Setterset_proximity_fade(value)
Getteris_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.


  • bool refraction_enabled
Defaultfalse
Setterset_feature(value)
Getterget_feature()

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


Setterset_refraction(value)
Getterget_refraction()

The strength of the refraction effect.


Setterset_texture(value)
Getterget_texture()

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


Setterset_refraction_texture_channel(value)
Getterget_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.


Setterset_rim(value)
Getterget_rim()

Sets the strength of the rim lighting effect.


Defaultfalse
Setterset_feature(value)
Getterget_feature()

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


Setterset_texture(value)
Getterget_texture()

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


Setterset_rim_tint(value)
Getterget_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.


Default1.0
Setterset_roughness(value)
Getterget_roughness()

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


Setterset_texture(value)
Getterget_texture()

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


Default0
Setterset_roughness_texture_channel(value)
Getterget_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.


  • bool subsurf_scatter_enabled
Defaultfalse
Setterset_feature(value)
Getterget_feature()

If true, subsurface scattering is enabled. Emulates light that penetrates an object’s surface, is scattered, and then emerges.


  • float subsurf_scatter_strength
Setterset_subsurface_scattering_strength(value)
Getterget_subsurface_scattering_strength()

The strength of the subsurface scattering effect.


Setterset_texture(value)
Getterget_texture()

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


Setterset_transmission(value)
Getterget_transmission()

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


  • bool transmission_enabled
Defaultfalse
Setterset_feature(value)
Getterget_feature()

If true, the transmission effect is enabled.


Setterset_texture(value)
Getterget_texture()

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


DefaultVector3( 0, 0, 0 )
Setterset_uv1_offset(value)
Getterget_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.


DefaultVector3( 1, 1, 1 )
Setterset_uv1_scale(value)
Getterget_uv1_scale()

How much to scale the UV coordinates. This is multiplied by UV in the vertex function.


Defaultfalse
Setterset_flag(value)
Getterget_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.


  • float uv1_triplanar_sharpness
Default1.0
Setterset_uv1_triplanar_blend_sharpness(value)
Getterget_uv1_triplanar_blend_sharpness()

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


DefaultVector3( 0, 0, 0 )
Setterset_uv2_offset(value)
Getterget_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.


DefaultVector3( 1, 1, 1 )
Setterset_uv2_scale(value)
Getterget_uv2_scale()

How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.


Defaultfalse
Setterset_flag(value)
Getterget_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.


  • float uv2_triplanar_sharpness
Default1.0
Setterset_uv2_triplanar_blend_sharpness(value)
Getterget_uv2_triplanar_blend_sharpness()

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


  • bool vertex_color_is_srgb
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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


  • bool vertex_color_use_as_albedo
Defaultfalse
Setterset_flag(value)
Getterget_flag()

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

Method Descriptions

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