Work in progress
Godot documentation is being updated to reflect the latest changes in version
4.0. Some documentation pages may
still state outdated information. This banner will tell you if you're reading one of such pages.
The contents of this page are up to date. If you can still find outdated information, please open an issue.
Inherits: Texture2D < Texture < Resource < RefCounted < Object
Texture with optional normal and specular maps for use in 2D rendering.
CanvasTexture is an alternative to ImageTexture for 2D rendering. It allows using normal maps and specular maps in any node that inherits from CanvasItem. CanvasTexture also allows overriding the texture's filter and repeat mode independently of the node's properties (or the project settings).
Note: CanvasTexture cannot be used in 3D rendering. For physically-based materials in 3D, use BaseMaterial3D instead.
The diffuse (color) texture to use. This is the main texture you want to set in most cases.
The normal map texture to use. Only has a visible effect if Light2Ds are affecting this CanvasTexture.
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.
Color specular_color =
Color(1, 1, 1, 1)
The multiplier for specular reflection colors. The Light2D's color is also taken into account when determining the reflection color. Only has a visible effect if Light2Ds are affecting this CanvasTexture.
float specular_shininess =
The specular exponent for Light2D specular reflections. Higher values result in a more glossy/"wet" look, with reflections becoming more localized and less visible overall. The default value of
1.0 disables specular reflections entirely. Only has a visible effect if Light2Ds are affecting this CanvasTexture.
The specular map to use for Light2D specular reflections. This should be a grayscale or colored texture, with brighter areas resulting in a higher specular_shininess value. Using a colored specular_texture allows controlling specular shininess on a per-channel basis. Only has a visible effect if Light2Ds are affecting this CanvasTexture.
TextureFilter texture_filter =
void set_texture_filter ( TextureFilter value )
TextureFilter get_texture_filter ( )
The texture filtering mode to use when drawing this CanvasTexture.
TextureRepeat texture_repeat =
void set_texture_repeat ( TextureRepeat value )
TextureRepeat get_texture_repeat ( )
The texture repeat mode to use when drawing this CanvasTexture.