Struct SpatialMaterial

Default 3D rendering material.

struct SpatialMaterial ;

This provides a default material with a wide variety of rendering features and properties without the need to write shader code. See the tutorial below for details.

Properties

NameTypeDescription
albedoColor[get, set] ColorThe material's base color.
albedoTexture[get, set] TextureTexture to multiply by albedoColor. Used for basic texturing of objects.
anisotropy[get, set] doubleThe strength of the anisotropy effect.
anisotropyEnabled[get, set] boolIf true, anisotropy is enabled. Changes the shape of the specular blob and aligns it to tangent space. Mesh tangents are needed for this to work. If the mesh does not contain tangents the anisotropy effect will appear broken.
anisotropyFlowmap[get, set] TextureTexture that offsets the tangent map for anisotropy calculations.
aoEnabled[get, set] boolIf true, ambient occlusion is enabled. Ambient occlusion darkens areas based on the aoTexture.
aoLightAffect[get, set] doubleAmount 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.
aoOnUv2[get, set] boolIf true, use UV2 coordinates to look up from the aoTexture.
aoTexture[get, set] TextureTexture that defines the amount of ambient occlusion for a given point on the object.
aoTextureChannel[get, set] SpatialMaterial.TextureChannelSpecifies the channel of the aoTexture 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.
clearcoat[get, set] doubleSets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.
clearcoatEnabled[get, set] boolIf 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.
clearcoatGloss[get, set] doubleSets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
clearcoatTexture[get, set] TextureTexture 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.
depthDeepParallax[get, set] boolIf 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.
depthEnabled[get, set] boolIf true, depth mapping is enabled (also called "parallax mapping" or "height mapping"). See also normalEnabled.
depthFlipBinormal[get, set] boolIf 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.
depthFlipTangent[get, set] boolIf 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.
depthMaxLayers[get, set] longNumber of layers to use when using depthDeepParallax 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.
depthMinLayers[get, set] longNumber of layers to use when using depthDeepParallax 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.
depthScale[get, set] doubleScales the depth offset effect. A higher number will create a larger depth.
depthTexture[get, set] TextureTexture used to determine depth at a given pixel. Depth is always stored in the red channel.
detailAlbedo[get, set] TextureTexture that specifies the color of the detail overlay.
detailBlendMode[get, set] SpatialMaterial.BlendModeSpecifies how the detailAlbedo should blend with the current ALBEDO. See blendmode for options.
detailEnabled[get, set] boolIf true, enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on detailMask. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
detailMask[get, set] TextureTexture used to specify how the detail textures get blended with the base textures.
detailNormal[get, set] TextureTexture that specifies the per-pixel normal of the detail overlay.
detailUvLayer[get, set] SpatialMaterial.DetailUVSpecifies whether to use UV or UV2 for the detail layer. See detailuv for options.
distanceFadeMaxDistance[get, set] doubleDistance at which the object fades fully and is no longer visible.
distanceFadeMinDistance[get, set] doubleDistance at which the object starts to fade. If the object is less than this distance away it will appear normal.
distanceFadeMode[get, set] SpatialMaterial.DistanceFadeModeSpecifies which type of fade to use. Can be any of the distancefademodes.
emission[get, set] ColorThe emitted light's color. See emissionEnabled.
emissionEnabled[get, set] boolIf 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.
emissionEnergy[get, set] doubleThe emitted light's strength. See emissionEnabled.
emissionOnUv2[get, set] boolUse UV2 to read from the emissionTexture.
emissionOperator[get, set] SpatialMaterial.EmissionOperatorSets how emission interacts with emissionTexture. Can either add or multiply. See emissionoperator for options.
emissionTexture[get, set] TextureTexture that specifies how much surface emits light at a given point.
flagsAlbedoTexForceSrgb[get, set] boolForces a conversion of the albedoTexture from sRGB space to linear space.
flagsDisableAmbientLight[get, set] boolIf true, the object receives no ambient light.
flagsDoNotReceiveShadows[get, set] boolIf true, the object receives no shadow that would otherwise be cast onto it.
flagsEnsureCorrectNormals[get, set] boolIf 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.
flagsFixedSize[get, set] boolIf true, the object is rendered at the same size regardless of distance.
flagsNoDepthTest[get, set] boolIf true, depth testing is disabled and the object will be drawn in render order.
flagsTransparent[get, set] boolIf true, transparency is enabled on the body. See also paramsBlendMode.
flagsUnshaded[get, set] boolIf true, the object is unaffected by lighting.
flagsUsePointSize[get, set] boolIf 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 paramsPointSize.
flagsUseShadowToOpacity[get, set] boolIf 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.
flagsVertexLighting[get, set] boolIf true, lighting is calculated per vertex rather than per pixel. This may increase performance on low-end devices.
flagsWorldTriplanar[get, set] boolIf true, triplanar mapping is calculated in world space rather than object local space. See also uv1Triplanar.
metallic[get, set] doubleThe reflectivity of the object's surface. The higher the value, the more light is reflected.
metallicSpecular[get, set] doubleSets 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.
metallicTexture[get, set] TextureTexture used to specify metallic for an object. This is multiplied by metallic.
metallicTextureChannel[get, set] SpatialMaterial.TextureChannelSpecifies the channel of the metallicTexture 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.
normalEnabled[get, set] boolIf true, normal mapping is enabled.
normalScale[get, set] doubleThe strength of the normal map's effect.
normalTexture[get, set] TextureTexture used to specify the normal at a given pixel. The normal_texture only uses the red and green channels. The normal read from normal_texture is oriented around the surface normal provided by the Mesh.
paramsAlphaScissorThreshold[get, set] doubleThreshold at which the alpha scissor will discard values.
paramsBillboardKeepScale[get, set] boolIf true, the shader will keep the scale set for the mesh. Otherwise the scale is lost when billboarding. Only applies when paramsBillboardMode is constant BILLBOARD_ENABLED.
paramsBillboardMode[get, set] SpatialMaterial.BillboardModeControls how the object faces the camera. See billboardmode.
paramsBlendMode[get, set] SpatialMaterial.BlendModeThe material's blend mode. Note: Values other than Mix force the object into the transparent pipeline. See blendmode.
paramsCullMode[get, set] SpatialMaterial.CullModeWhich side of the object is not drawn when backfaces are rendered. See cullmode.
paramsDepthDrawMode[get, set] SpatialMaterial.DepthDrawModeDetermines when depth rendering takes place. See depthdrawmode. See also flagsTransparent.
paramsDiffuseMode[get, set] SpatialMaterial.DiffuseModeThe algorithm used for diffuse light scattering. See diffusemode.
paramsGrow[get, set] boolIf true, enables the vertex grow setting. See paramsGrowAmount.
paramsGrowAmount[get, set] doubleGrows object vertices in the direction of their normals.
paramsLineWidth[get, set] doubleCurrently unimplemented in Godot.
paramsPointSize[get, set] doubleThe point size in pixels. See flagsUsePointSize.
paramsSpecularMode[get, set] SpatialMaterial.SpecularModeThe method for rendering the specular blob. See specularmode.
paramsUseAlphaScissor[get, set] boolIf true, the shader will discard all pixels that have an alpha value less than paramsAlphaScissorThreshold.
particlesAnimHFrames[get, set] longThe number of horizontal frames in the particle sprite sheet. Only enabled when using constant BILLBOARD_PARTICLES. See paramsBillboardMode.
particlesAnimLoop[get, set] boolIf true, particle animations are looped. Only enabled when using constant BILLBOARD_PARTICLES. See paramsBillboardMode.
particlesAnimVFrames[get, set] longThe number of vertical frames in the particle sprite sheet. Only enabled when using constant BILLBOARD_PARTICLES. See paramsBillboardMode.
proximityFadeDistance[get, set] doubleDistance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
proximityFadeEnable[get, set] boolIf true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
refractionEnabled[get, set] boolIf true, the refraction effect is enabled. Distorts transparency based on light from behind the object.
refractionScale[get, set] doubleThe strength of the refraction effect.
refractionTexture[get, set] TextureTexture that controls the strength of the refraction per-pixel. Multiplied by refractionScale.
refractionTextureChannel[get, set] SpatialMaterial.TextureChannelSpecifies the channel of the aoTexture 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.
rim[get, set] doubleSets the strength of the rim lighting effect.
rimEnabled[get, set] boolIf true, rim effect is enabled. Rim lighting increases the brightness at glancing angles on an object.
rimTexture[get, set] TextureTexture used to set the strength of the rim lighting effect per-pixel. Multiplied by rim.
rimTint[get, set] doubleThe 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.
roughness[get, set] doubleSurface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also metallic.
roughnessTexture[get, set] TextureTexture used to control the roughness per-pixel. Multiplied by roughness.
roughnessTextureChannel[get, set] SpatialMaterial.TextureChannelSpecifies the channel of the aoTexture 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.
subsurfScatterEnabled[get, set] boolIf true, subsurface scattering is enabled. Emulates light that penetrates an object's surface, is scattered, and then emerges.
subsurfScatterStrength[get, set] doubleThe strength of the subsurface scattering effect.
subsurfScatterTexture[get, set] TextureTexture used to control the subsurface scattering strength. Stored in the red texture channel. Multiplied by subsurfScatterStrength.
transmission[get, set] ColorThe color used by the transmission effect. Represents the light passing through an object.
transmissionEnabled[get, set] boolIf true, the transmission effect is enabled.
transmissionTexture[get, set] TextureTexture used to control the transmission effect per-pixel. Added to transmission.
uv1Offset[get, set] Vector3How 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.
uv1Scale[get, set] Vector3How much to scale the UV coordinates. This is multiplied by UV in the vertex function.
uv1Triplanar[get, set] boolIf 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.
uv1TriplanarSharpness[get, set] doubleA lower number blends the texture more softly while a higher number blends the texture more sharply.
uv2Offset[get, set] Vector3How 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.
uv2Scale[get, set] Vector3How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.
uv2Triplanar[get, set] boolIf 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.
uv2TriplanarSharpness[get, set] doubleA lower number blends the texture more softly while a higher number blends the texture more sharply.
vertexColorIsSrgb[get, set] boolIf true, the model's vertex colors are processed as sRGB mode.
vertexColorUseAsAlbedo[get, set] boolIf true, the vertex color is used as albedo color.

Methods

NameDescription
getAlbedo
getAlphaScissorThreshold
getAnisotropy
getAoLightAffect
getAoTextureChannel
getBillboardMode
getBlendMode
getClearcoat
getClearcoatGloss
getCullMode
getDepthDeepParallaxFlipBinormal
getDepthDeepParallaxFlipTangent
getDepthDeepParallaxMaxLayers
getDepthDeepParallaxMinLayers
getDepthDrawMode
getDepthScale
getDetailBlendMode
getDetailUv
getDiffuseMode
getDistanceFade
getDistanceFadeMaxDistance
getDistanceFadeMinDistance
getEmission
getEmissionEnergy
getEmissionOperator
getFeature Returns true, if the specifed feature is enabled.
getFlag Returns true, if the specified flag is enabled. See flags enumerator for options.
getGrow
getLineWidth
getMetallic
getMetallicTextureChannel
getNormalScale
getParticlesAnimHFrames
getParticlesAnimLoop
getParticlesAnimVFrames
getPointSize
getProximityFadeDistance
getRefraction
getRefractionTextureChannel
getRim
getRimTint
getRoughness
getRoughnessTextureChannel
getSpecular
getSpecularMode
getSubsurfaceScatteringStrength
getTexture Returns the Texture associated with the specified textureparam.
getTransmission
getUv1Offset
getUv1Scale
getUv1TriplanarBlendSharpness
getUv2Offset
getUv2Scale
getUv2TriplanarBlendSharpness
isDepthDeepParallaxEnabled
isGrowEnabled
isProximityFadeEnabled
setAlbedo
setAlphaScissorThreshold
setAnisotropy
setAoLightAffect
setAoTextureChannel
setBillboardMode
setBlendMode
setClearcoat
setClearcoatGloss
setCullMode
setDepthDeepParallax
setDepthDeepParallaxFlipBinormal
setDepthDeepParallaxFlipTangent
setDepthDeepParallaxMaxLayers
setDepthDeepParallaxMinLayers
setDepthDrawMode
setDepthScale
setDetailBlendMode
setDetailUv
setDiffuseMode
setDistanceFade
setDistanceFadeMaxDistance
setDistanceFadeMinDistance
setEmission
setEmissionEnergy
setEmissionOperator
setFeature 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.
setFlag If true, enables the specified flag. Flags are optional behaviour that can be turned on and off. Only one flag can be enabled at a time with this function, the flag enumerators cannot be bit-masked together to enable or disable multiple flags at once. Flags can also be enabled by setting the corresponding member to true. See flags enumerator for options.
setGrow
setGrowEnabled
setLineWidth
setMetallic
setMetallicTextureChannel
setNormalScale
setParticlesAnimHFrames
setParticlesAnimLoop
setParticlesAnimVFrames
setPointSize
setProximityFade
setProximityFadeDistance
setRefraction
setRefractionTextureChannel
setRim
setRimTint
setRoughness
setRoughnessTextureChannel
setSpecular
setSpecularMode
setSubsurfaceScatteringStrength
setTexture Sets the Texture to be used by the specified textureparam. This function is called when setting members ending in *_texture.
setTransmission
setUv1Offset
setUv1Scale
setUv1TriplanarBlendSharpness
setUv2Offset
setUv2Scale
setUv2TriplanarBlendSharpness

Enums

NameDescription
BillboardMode
BlendMode
Constants
CullMode
DepthDrawMode
DetailUV
DiffuseMode
DistanceFadeMode
EmissionOperator
Feature
Flags
SpecularMode
TextureChannel
TextureParam