Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
CanvasTexture
繼承: Texture2D < Texture < Resource < RefCounted < Object
用於 2D 算繪的紋理,帶有可選的法線和鏡面貼圖。
說明
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.
教學
屬性
resource_local_to_scene |
|
|
|
||
|
||
|
||
|
屬性說明
要使用的漫反射(顏色)紋理。這是你在大多數情況下要設定的主要紋理。
要使用的法線貼圖紋理。僅在有 Light2D 影響該 CanvasTexture 時才有可見的效果。
注意: Godot 期望使用 X+、Y+、Z+ 座標系,可參考 此頁 了解各引擎差異。
Color specular_color = Color(1, 1, 1, 1) 🔗
鏡面反射顏色的乘數。在確定反射顏色時,Light2D 的顏色也會被考慮在內。只有在 Light2D 影響到這個 CanvasTexture 時才有可見的效果。
float specular_shininess = 1.0 🔗
用於 Light2D 鏡面反射的鏡面指數。更高的值會產生更有光澤或更加“濕潤”的外觀,反射變得更局部,且整體上不太明顯。預設值為 1.0 ,將完全禁用鏡面反射。只有在 Light2D 影響到這個 CanvasTexture 時才會有可見的效果。
用於 Light2D 鏡面反射的鏡面貼圖。這應該是一個灰度或彩色紋理,更亮的區域會產生更高的 specular_shininess 值。使用彩色 specular_texture 允許在每個通道的基礎上控制鏡面反射光澤度。僅當 Light2D 影響該 CanvasTexture 時才有可見的效果。
TextureFilter texture_filter = 0 🔗
void set_texture_filter(value: TextureFilter)
TextureFilter get_texture_filter()
繪製該 CanvasTexture 時所使用的紋理篩選模式。
TextureRepeat texture_repeat = 0 🔗
void set_texture_repeat(value: TextureRepeat)
TextureRepeat get_texture_repeat()
繪製該 CanvasTexture 時所使用的紋理重複模式。