pub struct SpatialMaterial { /* private fields */ }
Expand description

core class SpatialMaterial inherits Material (reference-counted).

This class has related types in the spatial_material module.

Official documentation

See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.

Memory management

The lifetime of this object is automatically managed through reference counting.

Class hierarchy

SpatialMaterial inherits methods from:

Safety

All types in the Godot API have interior mutability in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Ownership in these types tracks whether ownership is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations§

source§

impl SpatialMaterial

Constants

source

pub const ASYNC_MODE_VISIBLE: i64 = 0i64

source

pub const BILLBOARD_DISABLED: i64 = 0i64

source

pub const BLEND_MODE_MIX: i64 = 0i64

source

pub const CULL_BACK: i64 = 0i64

source

pub const DEPTH_DRAW_OPAQUE_ONLY: i64 = 0i64

source

pub const DETAIL_UV_1: i64 = 0i64

source

pub const DIFFUSE_BURLEY: i64 = 0i64

source

pub const DISTANCE_FADE_DISABLED: i64 = 0i64

source

pub const EMISSION_OP_ADD: i64 = 0i64

source

pub const FEATURE_TRANSPARENT: i64 = 0i64

source

pub const FLAG_UNSHADED: i64 = 0i64

source

pub const SPECULAR_SCHLICK_GGX: i64 = 0i64

source

pub const TEXTURE_ALBEDO: i64 = 0i64

source

pub const TEXTURE_CHANNEL_RED: i64 = 0i64

source

pub const ASYNC_MODE_HIDDEN: i64 = 1i64

source

pub const BILLBOARD_ENABLED: i64 = 1i64

source

pub const BLEND_MODE_ADD: i64 = 1i64

source

pub const CULL_FRONT: i64 = 1i64

source

pub const DEPTH_DRAW_ALWAYS: i64 = 1i64

source

pub const DETAIL_UV_2: i64 = 1i64

source

pub const DIFFUSE_LAMBERT: i64 = 1i64

source

pub const DISTANCE_FADE_PIXEL_ALPHA: i64 = 1i64

source

pub const EMISSION_OP_MULTIPLY: i64 = 1i64

source

pub const FEATURE_EMISSION: i64 = 1i64

source

pub const FLAG_USE_VERTEX_LIGHTING: i64 = 1i64

source

pub const SPECULAR_BLINN: i64 = 1i64

source

pub const TEXTURE_CHANNEL_GREEN: i64 = 1i64

source

pub const TEXTURE_METALLIC: i64 = 1i64

source

pub const BILLBOARD_FIXED_Y: i64 = 2i64

source

pub const BLEND_MODE_SUB: i64 = 2i64

source

pub const CULL_DISABLED: i64 = 2i64

source

pub const DEPTH_DRAW_DISABLED: i64 = 2i64

source

pub const DIFFUSE_LAMBERT_WRAP: i64 = 2i64

source

pub const DISTANCE_FADE_PIXEL_DITHER: i64 = 2i64

source

pub const FEATURE_NORMAL_MAPPING: i64 = 2i64

source

pub const FLAG_DISABLE_DEPTH_TEST: i64 = 2i64

source

pub const SPECULAR_PHONG: i64 = 2i64

source

pub const TEXTURE_CHANNEL_BLUE: i64 = 2i64

source

pub const TEXTURE_ROUGHNESS: i64 = 2i64

source

pub const BILLBOARD_PARTICLES: i64 = 3i64

source

pub const BLEND_MODE_MUL: i64 = 3i64

source

pub const DEPTH_DRAW_ALPHA_OPAQUE_PREPASS: i64 = 3i64

source

pub const DIFFUSE_OREN_NAYAR: i64 = 3i64

source

pub const DISTANCE_FADE_OBJECT_DITHER: i64 = 3i64

source

pub const FEATURE_RIM: i64 = 3i64

source

pub const FLAG_ALBEDO_FROM_VERTEX_COLOR: i64 = 3i64

source

pub const SPECULAR_TOON: i64 = 3i64

source

pub const TEXTURE_CHANNEL_ALPHA: i64 = 3i64

source

pub const TEXTURE_EMISSION: i64 = 3i64

source

pub const DIFFUSE_TOON: i64 = 4i64

source

pub const FEATURE_CLEARCOAT: i64 = 4i64

source

pub const FLAG_SRGB_VERTEX_COLOR: i64 = 4i64

source

pub const SPECULAR_DISABLED: i64 = 4i64

source

pub const TEXTURE_CHANNEL_GRAYSCALE: i64 = 4i64

source

pub const TEXTURE_NORMAL: i64 = 4i64

source

pub const FEATURE_ANISOTROPY: i64 = 5i64

source

pub const FLAG_USE_POINT_SIZE: i64 = 5i64

source

pub const TEXTURE_RIM: i64 = 5i64

source

pub const FEATURE_AMBIENT_OCCLUSION: i64 = 6i64

source

pub const FLAG_FIXED_SIZE: i64 = 6i64

source

pub const TEXTURE_CLEARCOAT: i64 = 6i64

source

pub const FEATURE_DEPTH_MAPPING: i64 = 7i64

source

pub const FLAG_BILLBOARD_KEEP_SCALE: i64 = 7i64

source

pub const TEXTURE_FLOWMAP: i64 = 7i64

source

pub const FEATURE_SUBSURACE_SCATTERING: i64 = 8i64

source

pub const FLAG_UV1_USE_TRIPLANAR: i64 = 8i64

source

pub const TEXTURE_AMBIENT_OCCLUSION: i64 = 8i64

source

pub const FEATURE_TRANSMISSION: i64 = 9i64

source

pub const FLAG_UV2_USE_TRIPLANAR: i64 = 9i64

source

pub const TEXTURE_DEPTH: i64 = 9i64

source

pub const FEATURE_REFRACTION: i64 = 10i64

source

pub const FLAG_TRIPLANAR_USE_WORLD: i64 = 10i64

source

pub const TEXTURE_SUBSURFACE_SCATTERING: i64 = 10i64

source

pub const FEATURE_DETAIL: i64 = 11i64

source

pub const FLAG_AO_ON_UV2: i64 = 11i64

source

pub const TEXTURE_TRANSMISSION: i64 = 11i64

source

pub const FEATURE_MAX: i64 = 12i64

source

pub const FLAG_EMISSION_ON_UV2: i64 = 12i64

source

pub const TEXTURE_REFRACTION: i64 = 12i64

source

pub const FLAG_USE_ALPHA_SCISSOR: i64 = 13i64

source

pub const TEXTURE_DETAIL_MASK: i64 = 13i64

source

pub const FLAG_ALBEDO_TEXTURE_FORCE_SRGB: i64 = 14i64

source

pub const TEXTURE_DETAIL_ALBEDO: i64 = 14i64

source

pub const FLAG_DONT_RECEIVE_SHADOWS: i64 = 15i64

source

pub const TEXTURE_DETAIL_NORMAL: i64 = 15i64

source

pub const FLAG_ENSURE_CORRECT_NORMALS: i64 = 16i64

source

pub const TEXTURE_MAX: i64 = 16i64

source

pub const FLAG_DISABLE_AMBIENT_LIGHT: i64 = 17i64

source

pub const FLAG_USE_SHADOW_TO_OPACITY: i64 = 18i64

source

pub const FLAG_ALBEDO_TEXTURE_SDF: i64 = 19i64

source

pub const FLAG_MAX: i64 = 20i64

source§

impl SpatialMaterial

source

pub fn new() -> Ref<Self, Unique>

Creates a new instance of this object.

This is a reference-counted type. The returned object is automatically managed by Ref.

source

pub fn albedo(&self) -> Color

The material’s base color.

source

pub fn alpha_scissor_threshold(&self) -> f64

Threshold at which the alpha scissor will discard values.

source

pub fn anisotropy(&self) -> f64

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.

source

pub fn ao_light_affect(&self) -> f64

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.

source

pub fn ao_texture_channel(&self) -> TextureChannel

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.

source

pub fn async_mode(&self) -> AsyncMode

If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is Synchronous (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation. ASYNC_MODE_VISIBLE is the default and the best for most cases.

source

pub fn billboard_mode(&self) -> BillboardMode

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.

source

pub fn blend_mode(&self) -> BlendMode

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

source

pub fn clearcoat(&self) -> f64

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

source

pub fn clearcoat_gloss(&self) -> f64

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

source

pub fn cull_mode(&self) -> CullMode

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

source

pub fn depth_deep_parallax_flip_binormal(&self) -> bool

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.

source

pub fn depth_deep_parallax_flip_tangent(&self) -> bool

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.

source

pub fn depth_deep_parallax_max_layers(&self) -> i64

Number of layers to use when using [depth_deep_parallax][Self::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.

source

pub fn depth_deep_parallax_min_layers(&self) -> i64

Number of layers to use when using [depth_deep_parallax][Self::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.

source

pub fn depth_draw_mode(&self) -> DepthDrawMode

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

source

pub fn depth_scale(&self) -> f64

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

source

pub fn detail_blend_mode(&self) -> BlendMode

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

source

pub fn detail_uv(&self) -> DetailUv

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

source

pub fn diffuse_mode(&self) -> DiffuseMode

The algorithm used for diffuse light scattering. See DiffuseMode.

source

pub fn distance_fade(&self) -> DistanceFadeMode

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

source

pub fn distance_fade_max_distance(&self) -> f64

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.

source

pub fn distance_fade_min_distance(&self) -> f64

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.

source

pub fn emission(&self) -> Color

The emitted light’s color. See emission_enabled.

source

pub fn emission_energy(&self) -> f64

The emitted light’s strength. See emission_enabled.

source

pub fn emission_operator(&self) -> EmissionOperator

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

source

pub fn feature(&self, feature: i64) -> bool

Returns true, if the specified Feature is enabled.

source

pub fn flag(&self, flag: i64) -> bool

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

source

pub fn grow(&self) -> f64

Grows object vertices in the direction of their normals.

source

pub fn line_width(&self) -> f64

Currently unimplemented in Godot.

source

pub fn metallic(&self) -> f64

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.

source

pub fn metallic_texture_channel(&self) -> TextureChannel

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.

source

pub fn normal_scale(&self) -> f64

The strength of the normal map’s effect.

source

pub fn particles_anim_h_frames(&self) -> i64

The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn particles_anim_loop(&self) -> bool

If true, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn particles_anim_v_frames(&self) -> i64

The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn point_size(&self) -> f64

The point size in pixels. See flags_use_point_size.

source

pub fn proximity_fade_distance(&self) -> f64

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

source

pub fn refraction(&self) -> f64

The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.

source

pub fn refraction_texture_channel(&self) -> TextureChannel

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 metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.

source

pub fn rim(&self) -> f64

Sets the strength of the rim lighting effect.

source

pub fn rim_tint(&self) -> f64

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.

source

pub fn roughness(&self) -> f64

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

source

pub fn roughness_texture_channel(&self) -> TextureChannel

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.

source

pub fn specular(&self) -> f64

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.

source

pub fn specular_mode(&self) -> SpecularMode

The method for rendering the specular blob. See SpecularMode.

source

pub fn subsurface_scattering_strength(&self) -> f64

The strength of the subsurface scattering effect.

source

pub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>

Returns the Texture associated with the specified TextureParam.

source

pub fn transmission(&self) -> Color

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

source

pub fn uv1_offset(&self) -> Vector3

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.

source

pub fn uv1_scale(&self) -> Vector3

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

source

pub fn uv1_triplanar_blend_sharpness(&self) -> f64

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

source

pub fn uv2_offset(&self) -> Vector3

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.

source

pub fn uv2_scale(&self) -> Vector3

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

source

pub fn uv2_triplanar_blend_sharpness(&self) -> f64

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

source

pub fn is_depth_deep_parallax_enabled(&self) -> bool

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.

source

pub fn is_grow_enabled(&self) -> bool

If true, enables the vertex grow setting. See [params_grow_amount][Self::params_grow_amount].

source

pub fn is_proximity_fade_enabled(&self) -> bool

If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.

source

pub fn set_albedo(&self, albedo: Color)

The material’s base color.

source

pub fn set_alpha_scissor_threshold(&self, threshold: f64)

Threshold at which the alpha scissor will discard values.

source

pub fn set_anisotropy(&self, anisotropy: f64)

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.

source

pub fn set_ao_light_affect(&self, amount: f64)

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.

source

pub fn set_ao_texture_channel(&self, channel: i64)

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.

source

pub fn set_async_mode(&self, mode: i64)

If [member ProjectSettings.rendering/gles3/shaders/shader_compilation_mode] is Synchronous (with or without cache), this determines how this material must behave in regards to asynchronous shader compilation. ASYNC_MODE_VISIBLE is the default and the best for most cases.

source

pub fn set_billboard_mode(&self, mode: i64)

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.

source

pub fn set_blend_mode(&self, blend_mode: i64)

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

source

pub fn set_clearcoat(&self, clearcoat: f64)

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

source

pub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)

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

source

pub fn set_cull_mode(&self, cull_mode: i64)

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

source

pub fn set_depth_deep_parallax(&self, enable: bool)

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.

source

pub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)

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.

source

pub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)

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.

source

pub fn set_depth_deep_parallax_max_layers(&self, layer: i64)

Number of layers to use when using [depth_deep_parallax][Self::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.

source

pub fn set_depth_deep_parallax_min_layers(&self, layer: i64)

Number of layers to use when using [depth_deep_parallax][Self::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.

source

pub fn set_depth_draw_mode(&self, depth_draw_mode: i64)

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

source

pub fn set_depth_scale(&self, depth_scale: f64)

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

source

pub fn set_detail_blend_mode(&self, detail_blend_mode: i64)

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

source

pub fn set_detail_uv(&self, detail_uv: i64)

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

source

pub fn set_diffuse_mode(&self, diffuse_mode: i64)

The algorithm used for diffuse light scattering. See DiffuseMode.

source

pub fn set_distance_fade(&self, mode: i64)

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

source

pub fn set_distance_fade_max_distance(&self, distance: f64)

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.

source

pub fn set_distance_fade_min_distance(&self, distance: f64)

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.

source

pub fn set_emission(&self, emission: Color)

The emitted light’s color. See emission_enabled.

source

pub fn set_emission_energy(&self, emission_energy: f64)

The emitted light’s strength. See emission_enabled.

source

pub fn set_emission_operator(&self, operator: i64)

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

source

pub fn set_feature(&self, feature: i64, enable: bool)

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.

source

pub fn set_flag(&self, flag: i64, enable: 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.

source

pub fn set_grow(&self, amount: f64)

Grows object vertices in the direction of their normals.

source

pub fn set_grow_enabled(&self, enable: bool)

If true, enables the vertex grow setting. See [params_grow_amount][Self::params_grow_amount].

source

pub fn set_line_width(&self, line_width: f64)

Currently unimplemented in Godot.

source

pub fn set_metallic(&self, metallic: f64)

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.

source

pub fn set_metallic_texture_channel(&self, channel: i64)

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.

source

pub fn set_normal_scale(&self, normal_scale: f64)

The strength of the normal map’s effect.

source

pub fn set_particles_anim_h_frames(&self, frames: i64)

The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn set_particles_anim_loop(&self, loop_: bool)

If true, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn set_particles_anim_v_frames(&self, frames: i64)

The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].

source

pub fn set_point_size(&self, point_size: f64)

The point size in pixels. See flags_use_point_size.

source

pub fn set_proximity_fade(&self, enabled: bool)

If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.

source

pub fn set_proximity_fade_distance(&self, distance: f64)

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

source

pub fn set_refraction(&self, refraction: f64)

The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.

source

pub fn set_refraction_texture_channel(&self, channel: i64)

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 metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.

source

pub fn set_rim(&self, rim: f64)

Sets the strength of the rim lighting effect.

source

pub fn set_rim_tint(&self, rim_tint: f64)

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.

source

pub fn set_roughness(&self, roughness: f64)

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

source

pub fn set_roughness_texture_channel(&self, channel: i64)

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.

source

pub fn set_specular(&self, specular: f64)

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.

source

pub fn set_specular_mode(&self, specular_mode: i64)

The method for rendering the specular blob. See SpecularMode.

source

pub fn set_subsurface_scattering_strength(&self, strength: f64)

The strength of the subsurface scattering effect.

source

pub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)

Sets the Texture to be used by the specified TextureParam. This function is called when setting members ending in *_texture.

source

pub fn set_transmission(&self, transmission: Color)

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

source

pub fn set_uv1_offset(&self, offset: Vector3)

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.

source

pub fn set_uv1_scale(&self, scale: Vector3)

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

source

pub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)

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

source

pub fn set_uv2_offset(&self, offset: Vector3)

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.

source

pub fn set_uv2_scale(&self, scale: Vector3)

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

source

pub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)

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

source

pub fn albedo_texture(&self) -> Option<Ref<Texture, Shared>>

Texture to multiply by [albedo_color][Self::albedo_color]. Used for basic texturing of objects.

source

pub fn set_albedo_texture(&self, value: impl AsArg<Texture>)

Texture to multiply by [albedo_color][Self::albedo_color]. Used for basic texturing of objects.

source

pub fn anisotropy_enabled(&self) -> bool

If true, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium 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. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the Anisotropic checkbox then clicking Reimport. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].

source

pub fn set_anisotropy_enabled(&self, value: bool)

If true, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium 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. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the Anisotropic checkbox then clicking Reimport. The anisotropic filtering level can be changed by adjusting [member ProjectSettings.rendering/quality/filters/anisotropic_filter_level].

source

pub fn anisotropy_flowmap(&self) -> Option<Ref<Texture, Shared>>

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.

source

pub fn set_anisotropy_flowmap(&self, value: impl AsArg<Texture>)

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.

source

pub fn ao_enabled(&self) -> bool

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

source

pub fn set_ao_enabled(&self, value: bool)

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

source

pub fn ao_on_uv2(&self) -> bool

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

source

pub fn set_ao_on_uv2(&self, value: bool)

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

source

pub fn ao_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_ao_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn clearcoat_enabled(&self) -> bool

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 has flags_unshaded set to true.

source

pub fn set_clearcoat_enabled(&self, value: bool)

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 has flags_unshaded set to true.

source

pub fn clearcoat_texture(&self) -> Option<Ref<Texture, Shared>>

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.

source

pub fn set_clearcoat_texture(&self, value: impl AsArg<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.

source

pub fn depth_enabled(&self) -> bool

If true, depth mapping is enabled (also called “parallax mapping” or “height mapping”). See also normal_enabled. Note: Depth mapping is not supported if triplanar mapping is used on the same material. The value of depth_enabled will be ignored if uv1_triplanar is enabled.

source

pub fn set_depth_enabled(&self, value: bool)

If true, depth mapping is enabled (also called “parallax mapping” or “height mapping”). See also normal_enabled. Note: Depth mapping is not supported if triplanar mapping is used on the same material. The value of depth_enabled will be ignored if uv1_triplanar is enabled.

source

pub fn depth_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_depth_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn detail_albedo(&self) -> Option<Ref<Texture, Shared>>

Texture that specifies the color of the detail overlay.

source

pub fn set_detail_albedo(&self, value: impl AsArg<Texture>)

Texture that specifies the color of the detail overlay.

source

pub fn detail_enabled(&self) -> bool

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.

source

pub fn set_detail_enabled(&self, value: bool)

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.

source

pub fn detail_mask(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_detail_mask(&self, value: impl AsArg<Texture>)

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

source

pub fn detail_normal(&self) -> Option<Ref<Texture, Shared>>

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.

source

pub fn set_detail_normal(&self, value: impl AsArg<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.

source

pub fn emission_enabled(&self) -> bool

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.

source

pub fn set_emission_enabled(&self, value: bool)

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.

source

pub fn emission_on_uv2(&self) -> bool

Use UV2 to read from the emission_texture.

source

pub fn set_emission_on_uv2(&self, value: bool)

Use UV2 to read from the emission_texture.

source

pub fn emission_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_emission_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn flags_albedo_tex_force_srgb(&self) -> bool

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

source

pub fn set_flags_albedo_tex_force_srgb(&self, value: bool)

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

source

pub fn flags_albedo_tex_msdf(&self) -> bool

Enables signed distance field rendering shader.

source

pub fn set_flags_albedo_tex_msdf(&self, value: bool)

Enables signed distance field rendering shader.

source

pub fn flags_disable_ambient_light(&self) -> bool

If true, the object receives no ambient light.

source

pub fn set_flags_disable_ambient_light(&self, value: bool)

If true, the object receives no ambient light.

source

pub fn flags_do_not_receive_shadows(&self) -> bool

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

source

pub fn set_flags_do_not_receive_shadows(&self, value: bool)

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

source

pub fn flags_ensure_correct_normals(&self) -> bool

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.

source

pub fn set_flags_ensure_correct_normals(&self, value: bool)

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.

source

pub fn flags_fixed_size(&self) -> bool

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

source

pub fn set_flags_fixed_size(&self, value: bool)

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

source

pub fn flags_no_depth_test(&self) -> bool

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

source

pub fn set_flags_no_depth_test(&self, value: bool)

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

source

pub fn flags_transparent(&self) -> bool

If true, transparency is enabled on the body. See also [params_blend_mode][Self::params_blend_mode].

source

pub fn set_flags_transparent(&self, value: bool)

If true, transparency is enabled on the body. See also [params_blend_mode][Self::params_blend_mode].

source

pub fn flags_unshaded(&self) -> bool

If true, the object is unaffected by lighting.

source

pub fn set_flags_unshaded(&self, value: bool)

If true, the object is unaffected by lighting.

source

pub fn flags_use_point_size(&self) -> bool

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][Self::params_point_size].

source

pub fn set_flags_use_point_size(&self, value: bool)

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][Self::params_point_size].

source

pub fn flags_use_shadow_to_opacity(&self) -> bool

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.

source

pub fn set_flags_use_shadow_to_opacity(&self, value: bool)

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.

source

pub fn flags_vertex_lighting(&self) -> bool

If true, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled. See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials. Note: By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]’s mobile override. Note: flags_vertex_lighting has no effect if flags_unshaded is true.

source

pub fn set_flags_vertex_lighting(&self, value: bool)

If true, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices, especially for meshes with a lower polygon count. The downside is that shading becomes much less accurate, with visible linear interpolation between vertices that are joined together. This can be compensated by ensuring meshes have a sufficient level of subdivision (but not too much, to avoid reducing performance). Some material features are also not supported when vertex shading is enabled. See also [member ProjectSettings.rendering/quality/shading/force_vertex_shading] which can globally enable vertex shading on all materials. Note: By default, vertex shading is enforced on mobile platforms by [member ProjectSettings.rendering/quality/shading/force_vertex_shading]’s mobile override. Note: flags_vertex_lighting has no effect if flags_unshaded is true.

source

pub fn flags_world_triplanar(&self) -> bool

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

source

pub fn set_flags_world_triplanar(&self, value: bool)

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

source

pub fn metallic_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_metallic_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn normal_enabled(&self) -> bool

If true, normal mapping is enabled.

source

pub fn set_normal_enabled(&self, value: bool)

If true, normal mapping is enabled.

source

pub fn normal_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_normal_texture(&self, value: impl AsArg<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 SurfaceTool.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.

source

pub fn params_billboard_keep_scale(&self) -> bool

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][Self::params_billboard_mode] is BILLBOARD_ENABLED.

source

pub fn set_params_billboard_keep_scale(&self, value: bool)

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][Self::params_billboard_mode] is BILLBOARD_ENABLED.

source

pub fn params_use_alpha_scissor(&self) -> bool

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

source

pub fn set_params_use_alpha_scissor(&self, value: bool)

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

source

pub fn refraction_enabled(&self) -> bool

If true, the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material’s roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.

source

pub fn set_refraction_enabled(&self, value: bool)

If true, the refraction effect is enabled. Refraction distorts transparency based on light from behind the object. When using the GLES3 backend, the material’s roughness value will affect the blurriness of the refraction. Higher roughness values will make the refraction look blurrier.

source

pub fn refraction_texture(&self) -> Option<Ref<Texture, Shared>>

Texture that controls the strength of the refraction per-pixel. Multiplied by [refraction_scale][Self::refraction_scale].

source

pub fn set_refraction_texture(&self, value: impl AsArg<Texture>)

Texture that controls the strength of the refraction per-pixel. Multiplied by [refraction_scale][Self::refraction_scale].

source

pub fn rim_enabled(&self) -> bool

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 has flags_unshaded set to true.

source

pub fn set_rim_enabled(&self, value: bool)

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 has flags_unshaded set to true.

source

pub fn rim_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_rim_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn roughness_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_roughness_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn subsurf_scatter_enabled(&self) -> bool

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

source

pub fn set_subsurf_scatter_enabled(&self, value: bool)

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

source

pub fn subsurf_scatter_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_subsurf_scatter_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn transmission_enabled(&self) -> bool

If true, the transmission effect is enabled.

source

pub fn set_transmission_enabled(&self, value: bool)

If true, the transmission effect is enabled.

source

pub fn transmission_texture(&self) -> Option<Ref<Texture, Shared>>

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

source

pub fn set_transmission_texture(&self, value: impl AsArg<Texture>)

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

source

pub fn uv1_triplanar(&self) -> bool

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.

source

pub fn set_uv1_triplanar(&self, value: bool)

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.

source

pub fn uv2_triplanar(&self) -> bool

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.

source

pub fn set_uv2_triplanar(&self, value: bool)

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.

source

pub fn vertex_color_is_srgb(&self) -> bool

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

source

pub fn set_vertex_color_is_srgb(&self, value: bool)

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

source

pub fn vertex_color_use_as_albedo(&self) -> bool

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

source

pub fn set_vertex_color_use_as_albedo(&self, value: bool)

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

Methods from Deref<Target = Material>§

source

pub const RENDER_PRIORITY_MIN: i64 = -128i64

source

pub const RENDER_PRIORITY_MAX: i64 = 127i64

source

pub fn next_pass(&self) -> Option<Ref<Material, Shared>>

Sets the Material to be used for the next pass. This renders the object again using a different material. Note: This only applies to SpatialMaterials and ShaderMaterials with type “Spatial”.

source

pub fn render_priority(&self) -> i64

Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).

source

pub fn set_next_pass(&self, next_pass: impl AsArg<Material>)

Sets the Material to be used for the next pass. This renders the object again using a different material. Note: This only applies to SpatialMaterials and ShaderMaterials with type “Spatial”.

source

pub fn set_render_priority(&self, priority: i64)

Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).

Methods from Deref<Target = Resource>§

source

pub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>

Duplicates the resource, returning a new resource with the exported members copied. Note: To duplicate the resource the constructor is called without arguments. This method will error when the constructor doesn’t have default values. By default, sub-resources are shared between resource copies for efficiency. This can be changed by passing true to the subresources argument which will copy the subresources. Note: If subresources is true, this method will only perform a shallow copy. Nested resources within subresources will not be duplicated and will still be shared. Note: When duplicating a resource, only exported properties are copied. Other properties will be set to their default value in the new resource.

Default Arguments
  • subresources - false
source

pub fn emit_changed(&self)

Sample code is GDScript unless otherwise noted.

Emits the changed signal. If external objects which depend on this resource should be updated, this method must be called manually whenever the state of this resource has changed (such as modification of properties). The method is equivalent to:

emit_signal("changed")

Note: This method is called automatically for built-in resources.

source

pub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>

If [resource_local_to_scene][Self::resource_local_to_scene] is enabled and the resource was loaded from a PackedScene instantiation, returns the local scene where this resource’s unique copy is in use. Otherwise, returns null.

source

pub fn name(&self) -> GodotString

The name of the resource. This is an optional identifier. If [resource_name][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name][Self::resource_name] will be displayed as the tab name in the script editor.

source

pub fn path(&self) -> GodotString

The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.

source

pub fn get_rid(&self) -> Rid

Returns the RID of the resource (or an empty RID). Many resources (such as Texture, Mesh, etc) are high-level abstractions of resources stored in a server, so this function will return the original RID.

source

pub fn is_local_to_scene(&self) -> bool

If true, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.

source

pub fn set_local_to_scene(&self, enable: bool)

If true, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.

source

pub fn set_name(&self, name: impl Into<GodotString>)

The name of the resource. This is an optional identifier. If [resource_name][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name][Self::resource_name] will be displayed as the tab name in the script editor.

source

pub fn set_path(&self, path: impl Into<GodotString>)

The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.

source

pub fn setup_local_to_scene(&self)

This method is called when a resource with [resource_local_to_scene][Self::resource_local_to_scene] enabled is loaded from a PackedScene instantiation. Its behavior can be customized by overriding [_setup_local_to_scene][Self::_setup_local_to_scene] from script. For most resources, this method performs no base logic. ViewportTexture performs custom logic to properly set the proxy texture and flags in the local viewport.

source

pub fn take_over_path(&self, path: impl Into<GodotString>)

Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [resource_path][Self::resource_path], as the latter would error out if another resource was already cached for the given path.

Methods from Deref<Target = Object>§

source

pub fn add_user_signal(
    &self,
    signal: impl Into<GodotString>,
    arguments: VariantArray
)

Adds a user-defined signal. Arguments are optional, but can be added as an Array of dictionaries, each containing name: String and type: int (see [enum Variant.Type]) entries.

Default Arguments
  • arguments - [ ]
source

pub unsafe fn call(
    &self,
    method: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant

Sample code is GDScript unless otherwise noted.

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:

call("set", "position", Vector2(42.0, 0.0))

Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).

Safety

This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).

source

pub unsafe fn call_deferred(
    &self,
    method: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant

Sample code is GDScript unless otherwise noted.

Calls the method on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:

call_deferred("set", "position", Vector2(42.0, 0.0))

Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).

Safety

This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).

source

pub unsafe fn callv(
    &self,
    method: impl Into<GodotString>,
    arg_array: VariantArray
) -> Variant

Sample code is GDScript unless otherwise noted.

Calls the method on the object and returns the result. Contrarily to call, this method does not support a variable number of arguments but expects all parameters to be via a single Array.

callv("set", [ "position", Vector2(42.0, 0.0) ])
Safety

This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).

source

pub fn can_translate_messages(&self) -> bool

Returns true if the object can translate strings. See set_message_translation and tr.

source

pub fn connect(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>,
    binds: VariantArray,
    flags: i64
) -> GodotResult

Sample code is GDScript unless otherwise noted.

Connects a signal to a method on a target object. Pass optional binds to the call as an Array of parameters. These parameters will be passed to the method after any parameter used in the call to emit_signal. Use flags to set deferred or one-shot connections. See ConnectFlags constants. A signal can only be connected once to a method. It will print an error if already connected, unless the signal was connected with CONNECT_REFERENCE_COUNTED. To avoid this, first, use is_connected to check for existing connections. If the target is destroyed in the game’s lifecycle, the connection will be lost. Examples:

connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal

An example of the relationship between binds passed to connect and parameters used when calling emit_signal:

connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
    print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])
Default Arguments
  • binds - [ ]
  • flags - 0
source

pub fn disconnect(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>
)

Disconnects a signal from a method on the given target. If you try to disconnect a connection that does not exist, the method will print an error. Use is_connected to ensure that the connection exists.

source

pub fn emit_signal(
    &self,
    signal: impl Into<GodotString>,
    varargs: &[Variant]
) -> Variant

Sample code is GDScript unless otherwise noted.

Emits the given signal. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:

emit_signal("hit", weapon_type, damage)
emit_signal("game_over")
source

pub fn get(&self, property: impl Into<GodotString>) -> Variant

Returns the Variant value of the given property. If the property doesn’t exist, this will return null. Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

source

pub fn get_class(&self) -> GodotString

Returns the object’s class as a String. See also is_class. Note: get_class does not take class_name declarations into account. If the object has a class_name defined, the base class name will be returned instead.

source

pub fn get_incoming_connections(&self) -> VariantArray

Returns an Array of dictionaries with information about signals that are connected to the object. Each Dictionary contains three String entries:

  • source is a reference to the signal emitter.
  • signal_name is the name of the connected signal.
  • method_name is the name of the method to which the signal is connected.
source

pub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant

Gets the object’s property indexed by the given NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Examples: "position:x" or "material:next_pass:blend_mode". Note: Even though the method takes NodePath argument, it doesn’t support actual paths to Nodes in the scene tree, only colon-separated sub-property paths. For the purpose of nodes, use Node.get_node_and_resource instead.

source

pub fn get_instance_id(&self) -> i64

Returns the object’s unique instance ID. This ID can be saved in EncodedObjectAsID, and can be used to retrieve the object instance with [method @GDScript.instance_from_id].

source

pub fn get_meta(
    &self,
    name: impl Into<GodotString>,
    default: impl OwnedToVariant
) -> Variant

Returns the object’s metadata entry for the given name. Throws error if the entry does not exist, unless default is not null (in which case the default value will be returned).

Default Arguments
  • default - null
source

pub fn get_meta_list(&self) -> PoolArray<GodotString>

Returns the object’s metadata as a PoolStringArray.

source

pub fn get_method_list(&self) -> VariantArray

Returns the object’s methods and their signatures as an Array.

source

pub fn get_property_list(&self) -> VariantArray

Returns the object’s property list as an Array of dictionaries. Each property’s Dictionary contain at least name: String and type: int (see [enum Variant.Type]) entries. Optionally, it can also include hint: int (see [PropertyHint][PropertyHint]), hint_string: String, and usage: int (see [PropertyUsageFlags][PropertyUsageFlags]).

source

pub fn get_script(&self) -> Option<Ref<Reference, Shared>>

Returns the object’s Script instance, or null if none is assigned.

source

pub fn get_signal_connection_list(
    &self,
    signal: impl Into<GodotString>
) -> VariantArray

Returns an Array of connections for the given signal.

source

pub fn get_signal_list(&self) -> VariantArray

Returns the list of signals as an Array of dictionaries.

source

pub fn has_meta(&self, name: impl Into<GodotString>) -> bool

Returns true if a metadata entry is found with the given name.

source

pub fn has_method(&self, method: impl Into<GodotString>) -> bool

Returns true if the object contains the given method.

source

pub fn has_signal(&self, signal: impl Into<GodotString>) -> bool

Returns true if the given signal exists.

source

pub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool

Returns true if the given user-defined signal exists. Only signals added using add_user_signal are taken into account.

source

pub fn is_blocking_signals(&self) -> bool

Returns true if signal emission blocking is enabled.

source

pub fn is_class(&self, class: impl Into<GodotString>) -> bool

Returns true if the object inherits from the given class. See also get_class. Note: is_class does not take class_name declarations into account. If the object has a class_name defined, is_class will return false for that name.

source

pub fn is_connected(
    &self,
    signal: impl Into<GodotString>,
    target: impl AsArg<Object>,
    method: impl Into<GodotString>
) -> bool

Returns true if a connection exists for a given signal, target, and method.

source

pub fn is_queued_for_deletion(&self) -> bool

Returns true if the Node.queue_free method was called for the object.

source

pub fn notification(&self, what: i64, reversed: bool)

Send a given notification to the object, which will also trigger a call to the [_notification][Self::_notification] method of all classes that the object inherits from. If reversed is true, [_notification][Self::_notification] is called first on the object’s own class, and then up to its successive parent classes. If reversed is false, [_notification][Self::_notification] is called first on the highest ancestor (Object itself), and then down to its successive inheriting classes.

Default Arguments
  • reversed - false
source

pub fn property_list_changed_notify(&self)

Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.

source

pub fn remove_meta(&self, name: impl Into<GodotString>)

Removes a given entry from the object’s metadata. See also set_meta.

source

pub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)

Assigns a new value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing will happen. Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

source

pub fn set_block_signals(&self, enable: bool)

If set to true, signal emission is blocked.

source

pub fn set_deferred(
    &self,
    property: impl Into<GodotString>,
    value: impl OwnedToVariant
)

Assigns a new value to the given property, after the current frame’s physics step. This is equivalent to calling set via call_deferred, i.e. call_deferred("set", property, value). Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

source

pub fn set_indexed(
    &self,
    property: impl Into<NodePath>,
    value: impl OwnedToVariant
)

Sample code is GDScript unless otherwise noted.

Assigns a new value to the property identified by the NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Example:

set_indexed("position", Vector2(42, 0))
set_indexed("position:y", -10)
print(position) # (42, -10)
source

pub fn set_message_translation(&self, enable: bool)

Defines whether the object can translate strings (with calls to tr). Enabled by default.

source

pub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)

Adds, changes or removes a given entry in the object’s metadata. Metadata are serialized and can take any Variant value. To remove a given entry from the object’s metadata, use remove_meta. Metadata is also removed if its value is set to null. This means you can also use set_meta("name", null) to remove metadata for "name".

source

pub fn set_script(&self, script: impl AsArg<Reference>)

Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality. If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script’s [_init][Self::_init] method will be called.

source

pub fn to_string(&self) -> GodotString

Returns a String representing the object. If not overridden, defaults to "[ClassName:RID]". Override the method [_to_string][Self::_to_string] to customize the String representation.

source

pub fn tr(&self, message: impl Into<GodotString>) -> GodotString

Translates a message using translation catalogs configured in the Project Settings. Only works if message translation is enabled (which it is by default), otherwise it returns the message unchanged. See set_message_translation.

Trait Implementations§

source§

impl Debug for SpatialMaterial

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for SpatialMaterial

§

type Target = Material

The resulting type after dereferencing.
source§

fn deref(&self) -> &Material

Dereferences the value.
source§

impl DerefMut for SpatialMaterial

source§

fn deref_mut(&mut self) -> &mut Material

Mutably dereferences the value.
source§

impl GodotObject for SpatialMaterial

§

type Memory = RefCounted

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information.
source§

fn class_name() -> &'static str

source§

fn null() -> Null<Self>

Creates an explicitly null reference of Self as a method argument. This makes type inference easier for the compiler compared to Option.
source§

fn new() -> Ref<Self, Unique>where
    Self: Instanciable,

Creates a new instance of Self using a zero-argument constructor, as a Unique reference.
source§

fn cast<T>(&self) -> Option<&T>where
    T: GodotObject + SubClass<Self>,

Performs a dynamic reference downcast to target type. Read more
source§

fn upcast<T>(&self) -> &Twhere
    T: GodotObject,
    Self: SubClass<T>,

Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
source§

unsafe fn assume_shared(&self) -> Ref<Self, Shared>where
    Self: Sized,

Creates a persistent reference to the same Godot object with shared thread access. Read more
source§

unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal>where
    Self: Sized + GodotObject<Memory = RefCounted>,

Creates a persistent reference to the same Godot object with thread-local thread access. Read more
source§

unsafe fn assume_unique(&self) -> Ref<Self, Unique>where
    Self: Sized,

Creates a persistent reference to the same Godot object with unique access. Read more
source§

unsafe fn try_from_instance_id<'a>(id: i64) -> Option<TRef<'a, Self, Shared>>

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive. See also TRef::try_from_instance_id. Read more
source§

unsafe fn from_instance_id<'a>(id: i64) -> TRef<'a, Self, Shared>

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive, and panics otherwise. This does NOT guarantee that the resulting reference is safe to use. Read more
source§

impl Instanciable for SpatialMaterial

source§

impl Sealed for SpatialMaterial

source§

impl SubClass<Material> for SpatialMaterial

source§

impl SubClass<Object> for SpatialMaterial

source§

impl SubClass<Reference> for SpatialMaterial

source§

impl SubClass<Resource> for SpatialMaterial

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> SubClass<T> for Twhere
    T: GodotObject,