Index · Object → RefCounted → Resource → Material → BaseMaterial3D

BaseMaterial3D

Abstract base class for defining the 3D rendering properties of meshes.

Inherited by (2): ORMMaterial3DStandardMaterial3D
Class Description

This class serves as 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.

Properties

var albedo_color: Color = Color(1, 1, 1, 1)

The material's base color.

Note: If detail_enabled is true and a detail_albedo texture is specified, albedo_color will not modulate the detail texture. This can be used to color partial areas of a material by not specifying an albedo texture and using a transparent detail_albedo texture instead.

var albedo_texture: Texture2D

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

If the texture appears unexpectedly too dark or too bright, check albedo_texture_force_srgb.

var albedo_texture_force_srgb: bool = false

If true, forces a conversion of the albedo_texture from nonlinear sRGB encoding to linear encoding. See also vertex_color_is_srgb.

This should only be enabled when needed (typically when using a ViewportTexture as albedo_texture). If albedo_texture_force_srgb is true when it shouldn't be, the texture will appear to be too dark. If albedo_texture_force_srgb is false when it shouldn't be, the texture will appear to be too bright.

var albedo_texture_msdf: bool = false

Enables multichannel signed distance field rendering shader. Use msdf_pixel_range and msdf_outline_size to configure MSDF parameters.

var alpha_antialiasing_edge: float

Threshold at which antialiasing will be applied on the alpha channel.

var alpha_antialiasing_mode: BaseMaterial3D.AlphaAntiAliasing

The type of alpha antialiasing to apply.

var alpha_hash_scale: float

The hashing scale for Alpha Hash. Recommended values between 0 and 2.

var alpha_scissor_threshold: float

Threshold at which the alpha scissor will discard values. Higher values will result in more pixels being discarded. If the material becomes too opaque at a distance, try increasing alpha_scissor_threshold. If the material disappears at a distance, try decreasing alpha_scissor_threshold.

var anisotropy: float = 0.0

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.

var anisotropy_enabled: bool = false

If true, anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminum 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, which can be enabled by setting texture_filter to TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC.

var anisotropy_flowmap: Texture2D

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.

var ao_enabled: bool = false

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

var ao_light_affect: float = 0.0

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.

var ao_on_uv2: bool = false

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

var ao_texture: Texture2D

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

var ao_texture_channel: BaseMaterial3D.TextureChannel = 0

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.

var backlight: Color = Color(0, 0, 0, 1)

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

var backlight_enabled: bool = false

If true, the backlight effect is enabled. See also subsurf_scatter_transmittance_enabled.

var backlight_texture: Texture2D

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

var bent_normal_enabled: bool = false

If true, the bent normal map is enabled. This allows for more accurate indirect lighting and specular occlusion.

var bent_normal_texture: Texture2D

Texture that specifies the average direction of incoming ambient light at a given pixel. The bent_normal_texture only uses the red and green channels; the blue and alpha channels are ignored. The normal read from bent_normal_texture is oriented around the surface normal provided by the Mesh.

Note: A bent normal map is different from a regular normal map. When baking a bent normal map make sure to use a cosine distribution for the bent normal map to work correctly.

Note: The mesh must have both normals and tangents defined in its vertex data. Otherwise, the shading produced by the bent normal map will not look correct. 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 bent normal map to use X+, Y+, and Z+ coordinates. See this page for a comparison of normal map coordinates expected by popular engines.

var billboard_keep_scale: bool = false

If true, the shader will keep the scale set for the mesh. Otherwise, the scale is lost when billboarding. Only applies when billboard_mode is not BILLBOARD_DISABLED.

var billboard_mode: BaseMaterial3D.BillboardMode = 0

Controls how the object faces the camera.

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.

var blend_mode: BaseMaterial3D.BlendMode = 0

The material's blend mode.

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

var clearcoat: float = 1.0

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

var clearcoat_enabled: bool = false

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's shading_mode is SHADING_MODE_UNSHADED.

var clearcoat_roughness: float = 0.5

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

var clearcoat_texture: Texture2D

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.

var cull_mode: BaseMaterial3D.CullMode = 0

Determines which side of the triangle to cull depending on whether the triangle faces towards or away from the camera.

var depth_draw_mode: BaseMaterial3D.DepthDrawMode = 0

Determines when depth rendering takes place. See also transparency.

var depth_test: BaseMaterial3D.DepthTest = 0

Determines which comparison operator is used when testing depth.

Note: Changing depth_test to a non-default value only has a visible effect when used on a transparent material, or a material that has depth_draw_mode set to DEPTH_DRAW_DISABLED.

var detail_albedo: Texture2D

Texture that specifies the color of the detail overlay. detail_albedo's alpha channel is used as a mask, even when the material is opaque. To use a dedicated texture as a mask, see detail_mask.

Note: detail_albedo is not modulated by albedo_color.

var detail_blend_mode: BaseMaterial3D.BlendMode = 0

Specifies how the detail_albedo should blend with the current ALBEDO.

var detail_enabled: bool = false

If true, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detail_mask and detail_albedo's alpha channel. This can be used to add variation to objects, or to blend between two different albedo/normal textures.

var detail_mask: Texture2D

Texture used to specify how the detail textures get blended with the base textures. detail_mask can be used together with detail_albedo's alpha channel (if any).

var detail_normal: Texture2D

Texture that specifies the per-pixel normal of the detail overlay. The detail_normal texture only uses the red and green channels; the blue and alpha channels are ignored. The normal read from detail_normal 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.

var detail_uv_layer: BaseMaterial3D.DetailUV = 0

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

var diffuse_mode: BaseMaterial3D.DiffuseMode = 0

The algorithm used for diffuse light scattering.

var disable_ambient_light: bool = false

If true, the object receives no ambient light.

var disable_fog: bool = false

If true, the object will not be affected by fog (neither volumetric nor depth fog). This is useful for unshaded or transparent materials (e.g. particles), which without this setting will be affected even if fully transparent.

var disable_receive_shadows: bool = false

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

var disable_specular_occlusion: bool = false

If true, disables specular occlusion even if ProjectSettings.rendering/reflections/specular_occlusion/enabled is false.

var distance_fade_max_distance: float = 10.0

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.

var distance_fade_min_distance: float = 0.0

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.

var distance_fade_mode: BaseMaterial3D.DistanceFadeMode = 0

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

var emission: Color = Color(0, 0, 0, 1)

The emitted light's color. See emission_enabled.

var emission_enabled: bool = false

If true, the body emits light. Emitting light makes the object appear brighter. The object can also cast light on other objects if a VoxelGI, SDFGI, or LightmapGI is used and this object is used in baked lighting.

var emission_energy_multiplier: float = 1.0

Multiplier for emitted light. See emission_enabled.

var emission_intensity: float

Luminance of emitted light, measured in nits (candela per square meter). Only available when ProjectSettings.rendering/lights_and_shadows/use_physical_light_units is enabled. The default is roughly equivalent to an indoor lightbulb.

var emission_on_uv2: bool = false

Use UV2 to read from the emission_texture.

var emission_operator: BaseMaterial3D.EmissionOperator = 0

Sets how emission interacts with emission_texture. Can either add or multiply.

var emission_texture: Texture2D

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

var fixed_size: bool = false

If true, the object is rendered at the same size regardless of distance. The object's size on screen is the same as if the camera was 1.0 units away from the object's origin, regardless of the actual distance from the camera. The Camera3D's field of view (or Camera3D.size when in orthogonal/frustum mode) still affects the size the object is drawn at.

var fov_override: float = 75.0

Overrides the Camera3D's field of view angle (in degrees).

Note: This behaves as if the field of view is set on a Camera3D with Camera3D.keep_aspect set to Camera3D.KEEP_HEIGHT. Additionally, it may not look correct on a non-perspective camera where the field of view setting is ignored.

var grow: bool = false

If true, enables the vertex grow setting. This can be used to create mesh-based outlines using a second material pass and its cull_mode set to CULL_FRONT. See also grow_amount.

Note: Vertex growth cannot create new vertices, which means that visible gaps may occur in sharp corners. This can be alleviated by designing the mesh to use smooth normals exclusively using face weighted normals in the 3D authoring software. In this case, grow will be able to join every outline together, just like in the original mesh.

var grow_amount: float = 0.0

Grows object vertices in the direction of their normals. Only effective if grow is true.

var heightmap_deep_parallax: bool = false

If true, uses parallax occlusion mapping to represent depth in the material instead of simple offset mapping (see heightmap_enabled). This results in a more convincing depth effect, but is much more expensive on the GPU. Only enable this on materials where it makes a significant visual difference.

var heightmap_enabled: bool = false

If true, height mapping is enabled (also called "parallax mapping" or "depth mapping"). See also normal_enabled. Height mapping is a demanding feature on the GPU, so it should only be used on materials where it makes a significant visual difference.

Note: Height mapping is not supported if triplanar mapping is used on the same material. The value of heightmap_enabled will be ignored if uv1_triplanar is enabled.

var heightmap_flip_binormal: bool = false

If true, flips the mesh's binormal vectors when interpreting the height map. If the heightmap effect looks strange when the camera moves (even with a reasonable heightmap_scale), try setting this to true.

var heightmap_flip_tangent: bool = false

If true, flips the mesh's tangent vectors when interpreting the height map. If the heightmap effect looks strange when the camera moves (even with a reasonable heightmap_scale), try setting this to true.

var heightmap_flip_texture: bool = false

If true, interprets the height map texture as a depth map, with brighter values appearing to be "lower" in altitude compared to darker values.

This can be enabled for compatibility with some materials authored for Godot 3.x. This is not necessary if the Invert import option was used to invert the depth map in Godot 3.x, in which case heightmap_flip_texture should remain false.

var heightmap_max_layers: int

The number of layers to use for parallax occlusion mapping when the camera is up close to the material. Higher values result in a more convincing depth effect, especially in materials that have steep height changes. Higher values have a significant cost on the GPU, so it should only be increased on materials where it makes a significant visual difference.

Note: Only effective if heightmap_deep_parallax is true.

var heightmap_min_layers: int

The number of layers to use for parallax occlusion mapping when the camera is far away from the material. Higher values result in a more convincing depth effect, especially in materials that have steep height changes. Higher values have a significant cost on the GPU, so it should only be increased on materials where it makes a significant visual difference.

Note: Only effective if heightmap_deep_parallax is true.

var heightmap_scale: float = 5.0

The heightmap scale to use for the parallax effect (see heightmap_enabled). The default value is tuned so that the highest point (value = 255) appears to be 5 cm higher than the lowest point (value = 0). Higher values result in a deeper appearance, but may result in artifacts appearing when looking at the material from oblique angles, especially when the camera moves. Negative values can be used to invert the parallax effect, but this is different from inverting the texture using heightmap_flip_texture as the material will also appear to be "closer" to the camera. In most cases, heightmap_scale should be kept to a positive value.

Note: If the height map effect looks strange regardless of this value, try adjusting heightmap_flip_binormal and heightmap_flip_tangent. See also heightmap_texture for recommendations on authoring heightmap textures, as the way the heightmap texture is authored affects how heightmap_scale behaves.

var heightmap_texture: Texture2D

The texture to use as a height map. See also heightmap_enabled.

For best results, the texture should be normalized (with heightmap_scale reduced to compensate). In GIMP, this can be done using Colors > Auto > Equalize. If the texture only uses a small part of its available range, the parallax effect may look strange, especially when the camera moves.

Note: To reduce memory usage and improve loading times, you may be able to use a lower-resolution heightmap texture as most heightmaps are only comprised of low-frequency data.

var metallic: float = 0.0

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.

var metallic_specular: float = 0.5

Adjusts the strength of specular reflections. Specular reflections are composed of scene reflections and the specular lobe which is the bright spot that is reflected from light sources. When set to 0.0, no specular reflections will be visible. This differs from the SPECULAR_DISABLED SpecularMode as SPECULAR_DISABLED only applies to the specular lobe from the light source.

Note: Unlike metallic, this is not energy-conserving, so it should be left at 0.5 in most cases. See also roughness.

var metallic_texture: Texture2D

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

var metallic_texture_channel: BaseMaterial3D.TextureChannel = 0

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.

var msdf_outline_size: float = 0.0

The width of the shape outline.

var msdf_pixel_range: float = 4.0

The width of the range around the shape between the minimum and maximum representable signed distance.

var no_depth_test: bool = false

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

var normal_enabled: bool = false

If true, normal mapping is enabled. This has a slight performance cost, especially on mobile GPUs.

var normal_scale: float = 1.0

The strength of the normal map's effect.

var normal_texture: Texture2D

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.

Note: If detail_enabled is true, the detail_albedo texture is drawn below the normal_texture. To display a normal map above the detail_albedo texture, use detail_normal instead.

var orm_texture: Texture2D

The Occlusion/Roughness/Metallic texture to use. This is a more efficient replacement of ao_texture, roughness_texture and metallic_texture in ORMMaterial3D. Ambient occlusion is stored in the red channel. Roughness map is stored in the green channel. Metallic map is stored in the blue channel. The alpha channel is ignored.

var particles_anim_h_frames: int

The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See billboard_mode.

var particles_anim_loop: bool

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

var particles_anim_v_frames: int

The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See billboard_mode.

var point_size: float = 1.0

The point size in pixels. See use_point_size.

var proximity_fade_distance: float = 1.0

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

var proximity_fade_enabled: bool = false

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

var refraction_enabled: bool = false

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

Note: Refraction is implemented using the screen texture. Only opaque materials will appear in the refraction, since transparent materials do not appear in the screen texture.

var refraction_scale: float = 0.05

The strength of the refraction effect.

var refraction_texture: Texture2D

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

var refraction_texture_channel: BaseMaterial3D.TextureChannel = 0

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

var rim: float = 1.0

Sets the strength of the rim lighting effect.

var rim_enabled: bool = false

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's shading_mode is SHADING_MODE_UNSHADED.

var rim_texture: Texture2D

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

var rim_tint: float = 0.5

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.

var roughness: float = 1.0

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

var roughness_texture: Texture2D

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

var roughness_texture_channel: BaseMaterial3D.TextureChannel = 0

Specifies the channel of the roughness_texture in which the roughness 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.

var shading_mode: BaseMaterial3D.ShadingMode = 1

Sets whether the shading takes place, per-pixel, per-vertex or unshaded. Per-vertex lighting is faster, making it the best choice for mobile applications, however it looks considerably worse than per-pixel. Unshaded rendering is the fastest, but disables all interactions with lights.

var shadow_to_opacity: bool = false

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.

var specular_mode: BaseMaterial3D.SpecularMode = 0

The method for rendering the specular blob.

Note: specular_mode only applies to the specular blob. It does not affect specular reflections from the sky, screen-space reflections, VoxelGI, SDFGI or ReflectionProbes. To disable reflections from these sources as well, set metallic_specular to 0.0 instead.

var stencil_color: Color = Color(0, 0, 0, 1)

The primary color of the stencil effect.

var stencil_compare: BaseMaterial3D.StencilCompare = 0

The comparison operator to use for stencil masking operations.

var stencil_flags: int = 0

The flags dictating how the stencil operation behaves.

var stencil_mode: BaseMaterial3D.StencilMode = 0

The stencil effect mode.

var stencil_outline_thickness: float = 0.01

The outline thickness for STENCIL_MODE_OUTLINE.

var stencil_reference: int = 1

The stencil reference value (0-255). Typically a power of 2.

var subsurf_scatter_enabled: bool = false

If true, subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges. Subsurface scattering quality is controlled by ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_quality.

Note: Subsurface scattering is not supported on viewports that have a transparent background (where Viewport.transparent_bg is true).

var subsurf_scatter_skin_mode: bool = false

If true, subsurface scattering will use a special mode optimized for the color and density of human skin, such as boosting the intensity of the red channel in subsurface scattering.

var subsurf_scatter_strength: float = 0.0

The strength of the subsurface scattering effect. The depth of the effect is also controlled by ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_scale, which is set globally.

var subsurf_scatter_texture: Texture2D

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

var subsurf_scatter_transmittance_boost: float = 0.0

The intensity of the subsurface scattering transmittance effect.

var subsurf_scatter_transmittance_color: Color = Color(1, 1, 1, 1)

The color to multiply the subsurface scattering transmittance effect with. Ignored if subsurf_scatter_skin_mode is true.

var subsurf_scatter_transmittance_depth: float = 0.1

The depth of the subsurface scattering transmittance effect.

var subsurf_scatter_transmittance_enabled: bool = false

If true, enables subsurface scattering transmittance. Only effective if subsurf_scatter_enabled is true. See also backlight_enabled.

var subsurf_scatter_transmittance_texture: Texture2D

The texture to use for multiplying the intensity of the subsurface scattering transmittance intensity. See also subsurf_scatter_texture. Ignored if subsurf_scatter_skin_mode is true.

var texture_filter: BaseMaterial3D.TextureFilter = 3

Filter flags for the texture.

Note: heightmap_texture is always sampled with linear filtering, even if nearest-neighbor filtering is selected here. This is to ensure the heightmap effect looks as intended. If you need sharper height transitions between pixels, resize the heightmap texture in an image editor with nearest-neighbor filtering.

var texture_repeat: bool = true

If true, the texture repeats when exceeding the texture's size. See FLAG_USE_TEXTURE_REPEAT.

var transparency: BaseMaterial3D.Transparency = 0

The material's transparency mode. Some transparency modes will disable shadow casting. Any transparency mode other than TRANSPARENCY_DISABLED has a greater performance impact compared to opaque rendering. See also blend_mode.

var use_fov_override: bool = false

If true use fov_override to override the Camera3D's field of view angle.

var use_particle_trails: bool = false

If true, enables parts of the shader required for GPUParticles3D trails to function. This also requires using a mesh with appropriate skinning, such as RibbonTrailMesh or TubeTrailMesh. Enabling this feature outside of materials used in GPUParticles3D meshes will break material rendering.

var use_point_size: bool = false

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

var use_z_clip_scale: bool = false

If true use z_clip_scale to scale the object being rendered towards the camera to avoid clipping into things like walls.

var uv1_offset: Vector3 = Vector3(0, 0, 0)

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. The Z component is used when uv1_triplanar is enabled, but it is not used anywhere else.

var uv1_scale: Vector3 = Vector3(1, 1, 1)

How much to scale the UV coordinates. This is multiplied by UV in the vertex function. The Z component is used when uv1_triplanar is enabled, but it is not used anywhere else.

var uv1_triplanar: bool = false

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.

var uv1_triplanar_sharpness: float = 1.0

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

Note: uv1_triplanar_sharpness is clamped between 0.0 and 150.0 (inclusive) as values outside that range can look broken depending on the mesh.

var uv1_world_triplanar: bool = false

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

var uv2_offset: Vector3 = Vector3(0, 0, 0)

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. The Z component is used when uv2_triplanar is enabled, but it is not used anywhere else.

var uv2_scale: Vector3 = Vector3(1, 1, 1)

How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function. The Z component is used when uv2_triplanar is enabled, but it is not used anywhere else.

var uv2_triplanar: bool = false

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.

var uv2_triplanar_sharpness: float = 1.0

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

Note: uv2_triplanar_sharpness is clamped between 0.0 and 150.0 (inclusive) as values outside that range can look broken depending on the mesh.

var uv2_world_triplanar: bool = false

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

var vertex_color_is_srgb: bool = false

If true, vertex colors are considered to be stored in nonlinear sRGB encoding and are converted to linear encoding during rendering. If false, vertex colors are considered to be stored in linear encoding and are rendered as-is. See also albedo_texture_force_srgb.

Note: Only effective when using the Forward+ and Mobile rendering methods, not Compatibility.

var vertex_color_use_as_albedo: bool = false

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

var z_clip_scale: float = 1.0

Scales the object being rendered towards the camera to avoid clipping into things like walls. This is intended to be used for objects that are fixed with respect to the camera like player arms, tools, etc. Lighting and shadows will continue to work correctly when this setting is adjusted, but screen-space effects like SSAO and SSR may break with lower scales. Therefore, try to keep this setting as close to 1.0 as possible.

Inherited from Material (2)
Inherited from Resource (4)

Methods

func get_feature(feature: BaseMaterial3D.Feature) -> bool

Returns true if the specified feature is enabled.

func get_flag(flag: BaseMaterial3D.Flags) -> bool

Returns true if the specified flag is enabled.

func get_texture(param: BaseMaterial3D.TextureParam) -> Texture2D

Returns the Texture2D associated with the specified texture param.

func set_feature(feature: BaseMaterial3D.Feature, enable: bool) -> void

If enable is true, enables the specified feature. Many features that are available in BaseMaterial3D 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 their corresponding property to true.

func set_flag(flag: BaseMaterial3D.Flags, enable: bool) -> void

If enable is 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 their corresponding property to true.

func set_texture(param: BaseMaterial3D.TextureParam, texture: Texture2D) -> void

Sets the texture for the slot specified by param.

Inherited from Material (6)
Inherited from Resource (18)
func _get_rid() -> RID
func _reset_state() -> void
func _set_path_cache(path: String) -> void
func _setup_local_to_scene() -> void
func copy_from_resource(resource: Resource) -> Error
func duplicate(deep: bool = false) -> Resource
func duplicate_deep(deep_subresources_mode: Resource.DeepDuplicateMode = 1) -> Resource
func emit_changed() -> void
func get_rid() -> RID
func is_built_in() -> bool
func reset_state() -> void
func set_id_for_path(path: String, id: String) -> void
func set_path_cache(path: String) -> void
func setup_local_to_scene() -> void
func take_over_path(path: String) -> void
Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Resource (2)
signal changed()
Inherited from Object (2)

Enums & Constants

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_BENT_NORMAL = 18

Texture specifying per-pixel bent 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_HEIGHTMAP = 9

Texture specifying per-pixel height.

TEXTURE_SUBSURFACE_SCATTERING = 10

Texture specifying per-pixel subsurface scattering.

TEXTURE_SUBSURFACE_TRANSMITTANCE = 11

Texture specifying per-pixel transmittance for subsurface scattering.

TEXTURE_BACKLIGHT = 12

Texture specifying per-pixel backlight color.

TEXTURE_REFRACTION = 13

Texture specifying per-pixel refraction strength.

TEXTURE_DETAIL_MASK = 14

Texture specifying per-pixel detail mask blending value.

TEXTURE_DETAIL_ALBEDO = 15

Texture specifying per-pixel detail color.

TEXTURE_DETAIL_NORMAL = 16

Texture specifying per-pixel detail normal.

TEXTURE_ORM = 17

Texture holding ambient occlusion, roughness, and metallic.

TEXTURE_MAX = 19

Represents the size of the TextureParam enum.

enum TextureFilter
TEXTURE_FILTER_NEAREST = 0

The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled).

TEXTURE_FILTER_LINEAR = 1

The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled).

TEXTURE_FILTER_NEAREST_WITH_MIPMAPS = 2

The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look pixelated from up close, and smooth from a distance.

TEXTURE_FILTER_LINEAR_WITH_MIPMAPS = 3

The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look smooth from up close, and smooth from a distance.

TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC = 4

The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true) based on the angle between the surface and the camera view. This makes the texture look pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level.

TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC = 5

The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true) based on the angle between the surface and the camera view. This makes the texture look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level.

TEXTURE_FILTER_MAX = 6

Represents the size of the TextureFilter enum.

enum DetailUV
DETAIL_UV_1 = 0

Use UV with the detail texture.

DETAIL_UV_2 = 1

Use UV2 with the detail texture.

enum Transparency
TRANSPARENCY_DISABLED = 0

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

TRANSPARENCY_ALPHA = 1

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

TRANSPARENCY_ALPHA_SCISSOR = 2

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

TRANSPARENCY_ALPHA_HASH = 3

The material will cut off all values below a spatially-deterministic threshold, the rest will remain opaque. This is faster to render than alpha blending, but slower than opaque rendering. This also supports casting shadows. Alpha hashing is suited for hair rendering.

TRANSPARENCY_ALPHA_DEPTH_PRE_PASS = 4

The material will use the texture's alpha value for transparency, but will discard fragments with an alpha of less than 0.99 during the depth prepass and fragments with an alpha less than 0.1 during the shadow pass. This also supports casting shadows.

TRANSPARENCY_MAX = 5

Represents the size of the Transparency enum.

enum ShadingMode
SHADING_MODE_UNSHADED = 0

The object will not receive shadows. This is the fastest to render, but it disables all interactions with lights.

SHADING_MODE_PER_PIXEL = 1

The object will be shaded per pixel. Useful for realistic shading effects.

SHADING_MODE_PER_VERTEX = 2

The object will be shaded per vertex. Useful when you want cheaper shaders and do not care about visual quality.

SHADING_MODE_MAX = 3

Represents the size of the ShadingMode enum.

enum Feature
FEATURE_EMISSION = 0

Constant for setting emission_enabled.

FEATURE_NORMAL_MAPPING = 1

Constant for setting normal_enabled.

FEATURE_RIM = 2

Constant for setting rim_enabled.

FEATURE_CLEARCOAT = 3

Constant for setting clearcoat_enabled.

FEATURE_ANISOTROPY = 4

Constant for setting anisotropy_enabled.

FEATURE_AMBIENT_OCCLUSION = 5

Constant for setting ao_enabled.

FEATURE_HEIGHT_MAPPING = 6

Constant for setting heightmap_enabled.

FEATURE_SUBSURFACE_SCATTERING = 7

Constant for setting subsurf_scatter_enabled.

FEATURE_SUBSURFACE_TRANSMITTANCE = 8

Constant for setting subsurf_scatter_transmittance_enabled.

FEATURE_BACKLIGHT = 9

Constant for setting backlight_enabled.

FEATURE_REFRACTION = 10

Constant for setting refraction_enabled.

FEATURE_DETAIL = 11

Constant for setting detail_enabled.

FEATURE_BENT_NORMAL_MAPPING = 12

Constant for setting bent_normal_enabled.

FEATURE_MAX = 13

Represents the size of the Feature enum.

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.

BLEND_MODE_PREMULT_ALPHA = 4

The color of the object is added to the background and the alpha channel is used to mask out the background. This is effectively a hybrid of the blend mix and add modes, useful for effects like fire where you want the flame to add but the smoke to mix. By default, this works with unshaded materials using premultiplied textures. For shaded materials, use the PREMUL_ALPHA_FACTOR built-in so that lighting can be modulated as well.

enum AlphaAntiAliasing
ALPHA_ANTIALIASING_OFF = 0

Disables Alpha AntiAliasing for the material.

ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE = 1

Enables AlphaToCoverage. Alpha values in the material are passed to the AntiAliasing sample mask.

ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE = 2

Enables AlphaToCoverage and forces all non-zero alpha values to 1. Alpha values in the material are passed to the AntiAliasing sample mask.

enum DepthDrawMode
DEPTH_DRAW_OPAQUE_ONLY = 0

Default depth draw mode. Depth is drawn only for opaque objects during the opaque prepass (if any) and during the opaque pass.

DEPTH_DRAW_ALWAYS = 1

Objects will write to depth during the opaque and the transparent passes. Transparent objects that are close to the camera may obscure other transparent objects behind them.

Note: This does not influence whether transparent objects are included in the depth prepass or not. For that, see Transparency.

DEPTH_DRAW_DISABLED = 2

Objects will not write their depth to the depth buffer, even during the depth prepass (if enabled).

enum DepthTest
DEPTH_TEST_DEFAULT = 0

Depth test will discard the pixel if it is behind other pixels.

DEPTH_TEST_INVERTED = 1

Depth test will discard the pixel if it is in front of other pixels. Useful for stencil effects.

enum CullMode
CULL_BACK = 0

Default cull mode. The back of the object is culled when not visible. Back face triangles will be culled when facing the camera. This results in only the front side of triangles being drawn. For closed-surface meshes, this means that only the exterior of the mesh will be visible.

CULL_FRONT = 1

Front face triangles will be culled when facing the camera. This results in only the back side of triangles being drawn. For closed-surface meshes, this means that the interior of the mesh will be drawn instead of the exterior.

CULL_DISABLED = 2

No face culling is performed; both the front face and back face will be visible.

enum Flags
FLAG_DISABLE_DEPTH_TEST = 0

Disables the depth test, so this object is drawn on top of all others drawn before it. This puts the object in the transparent draw pass where it is sorted based on distance to camera. Objects drawn after it in the draw order may cover it. This also disables writing to depth.

FLAG_ALBEDO_FROM_VERTEX_COLOR = 1

Set ALBEDO to the per-vertex color specified in the mesh.

FLAG_SRGB_VERTEX_COLOR = 2

Vertex colors are considered to be stored in nonlinear sRGB encoding and are converted to linear encoding during rendering. See also vertex_color_is_srgb.

Note: Only effective when using the Forward+ and Mobile rendering methods.

FLAG_USE_POINT_SIZE = 3

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 = 4

Object is scaled by depth so that it always appears the same size on screen.

FLAG_BILLBOARD_KEEP_SCALE = 5

Shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when billboard_mode is BILLBOARD_ENABLED.

FLAG_UV1_USE_TRIPLANAR = 6

Use triplanar texture lookup for all texture lookups that would normally use UV.

FLAG_UV2_USE_TRIPLANAR = 7

Use triplanar texture lookup for all texture lookups that would normally use UV2.

FLAG_UV1_USE_WORLD_TRIPLANAR = 8

Use triplanar texture lookup for all texture lookups that would normally use UV.

FLAG_UV2_USE_WORLD_TRIPLANAR = 9

Use triplanar texture lookup for all texture lookups that would normally use UV2.

FLAG_AO_ON_UV2 = 10

Use UV2 coordinates to look up from the ao_texture.

FLAG_EMISSION_ON_UV2 = 11

Use UV2 coordinates to look up from the emission_texture.

FLAG_ALBEDO_TEXTURE_FORCE_SRGB = 12

Forces the shader to convert albedo from nonlinear sRGB encoding to linear encoding. See also albedo_texture_force_srgb.

FLAG_DONT_RECEIVE_SHADOWS = 13

Disables receiving shadows from other objects.

FLAG_DISABLE_AMBIENT_LIGHT = 14

Disables receiving ambient light.

FLAG_USE_SHADOW_TO_OPACITY = 15

Enables the shadow to opacity feature.

FLAG_USE_TEXTURE_REPEAT = 16

Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of the linear filtering modes, this can result in artifacts at the edges of a texture when the sampler filters across the edges of the texture.

FLAG_INVERT_HEIGHTMAP = 17

Invert values read from a depth texture to convert them to height values (heightmap).

FLAG_SUBSURFACE_MODE_SKIN = 18

Enables the skin mode for subsurface scattering which is used to improve the look of subsurface scattering when used for human skin.

FLAG_PARTICLE_TRAILS_MODE = 19

Enables parts of the shader required for GPUParticles3D trails to function. This also requires using a mesh with appropriate skinning, such as RibbonTrailMesh or TubeTrailMesh. Enabling this feature outside of materials used in GPUParticles3D meshes will break material rendering.

FLAG_ALBEDO_TEXTURE_MSDF = 20

Enables multichannel signed distance field rendering shader.

FLAG_DISABLE_FOG = 21

Disables receiving depth-based or volumetric fog.

FLAG_DISABLE_SPECULAR_OCCLUSION = 22

Disables specular occlusion.

FLAG_USE_Z_CLIP_SCALE = 23

Enables using z_clip_scale.

FLAG_USE_FOV_OVERRIDE = 24

Enables using fov_override.

FLAG_MAX = 25

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_TOON = 3

Uses a hard cut for lighting, with smoothing affected by roughness.

enum SpecularMode
SPECULAR_SCHLICK_GGX = 0

Default specular blob.

Note: Forward+ uses multiscattering for more accurate reflections, although the impact of multiscattering is more noticeable on rough metallic surfaces than on smooth, non-metallic surfaces.

Note: Mobile and Compatibility don't perform multiscattering for performance reasons. Instead, they perform single scattering, which means rough metallic surfaces may look slightly darker than intended.

SPECULAR_TOON = 1

Toon blob which changes size based on roughness.

SPECULAR_DISABLED = 2

No specular blob. This is slightly faster to render than other specular modes.

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 GPUParticles3D and CPUParticles3D nodes (flipbook animation). Enables particles_anim_* properties.

The ParticleProcessMaterial.anim_speed_min or CPUParticles3D.anim_speed_min should also be set to a value bigger than zero 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

Used to read from the linear (non-perceptual) average of the red, green and blue channels of a texture.

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 dithering 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 dithering 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 and DISTANCE_FADE_PIXEL_DITHER.

enum StencilMode
STENCIL_MODE_DISABLED = 0

Disables stencil operations.

STENCIL_MODE_OUTLINE = 1

Stencil preset which applies an outline to the object.

Note: Requires a Material.next_pass material which will be automatically applied. Any manual changes made to Material.next_pass will be lost when the stencil properties are modified or the scene is reloaded. To safely apply a Material.next_pass material on a material that uses stencil presets, use GeometryInstance3D.material_overlay instead.

STENCIL_MODE_XRAY = 2

Stencil preset which shows a silhouette of the object behind walls.

Note: Requires a Material.next_pass material which will be automatically applied. Any manual changes made to Material.next_pass will be lost when the stencil properties are modified or the scene is reloaded. To safely apply a Material.next_pass material on a material that uses stencil presets, use GeometryInstance3D.material_overlay instead.

STENCIL_MODE_CUSTOM = 3

Enables stencil operations without a preset.

enum StencilFlags
STENCIL_FLAG_READ = 1

The material will only be rendered where it passes a stencil comparison with existing stencil buffer values.

STENCIL_FLAG_WRITE = 2

The material will write the reference value to the stencil buffer where it passes the depth test.

STENCIL_FLAG_WRITE_DEPTH_FAIL = 4

The material will write the reference value to the stencil buffer where it fails the depth test.

enum StencilCompare
STENCIL_COMPARE_ALWAYS = 0

Always passes the stencil test.

STENCIL_COMPARE_LESS = 1

Passes the stencil test when the reference value is less than the existing stencil value.

STENCIL_COMPARE_EQUAL = 2

Passes the stencil test when the reference value is equal to the existing stencil value.

STENCIL_COMPARE_LESS_OR_EQUAL = 3

Passes the stencil test when the reference value is less than or equal to the existing stencil value.

STENCIL_COMPARE_GREATER = 4

Passes the stencil test when the reference value is greater than the existing stencil value.

STENCIL_COMPARE_NOT_EQUAL = 5

Passes the stencil test when the reference value is not equal to the existing stencil value.

STENCIL_COMPARE_GREATER_OR_EQUAL = 6

Passes the stencil test when the reference value is greater than or equal to the existing stencil value.