Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

CanvasTexture

Inherits: Texture2D < Texture < Resource < RefCounted < Object

Texture with optional normal and specular maps for use in 2D rendering.

Description

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. It will not display correctly when applied to any VisualInstance3D, such as Sprite3D or Decal. For physically-based materials in 3D, use BaseMaterial3D instead.

Tutorials

Properties

Texture2D

diffuse_texture

Texture2D

normal_texture

bool

resource_local_to_scene

false (overrides Resource)

Color

specular_color

Color(1, 1, 1, 1)

float

specular_shininess

1.0

Texture2D

specular_texture

TextureFilter

texture_filter

0

TextureRepeat

texture_repeat

0


Property Descriptions

Texture2D diffuse_texture

  • void set_diffuse_texture ( Texture2D value )