CanvasTexture
Diffuse, normal and specular texture set for 2D lighting.
CanvasTexture groups DiffuseTexture, NormalTexture and SpecularTexture references for CanvasItem. Assign it to Sprite2D or another suitable 2D consumer; lighting, material and maps still need consistent setup. Assigning a normal map does not add relief geometry or lighting by itself. This is a 2D resource rather than a 3D material replacement.
Dimensions, GetImage and HasAlpha depend only on DiffuseTexture. GetImage does not combine normals and specular into a lit frame. NormalTexture and SpecularTexture use aligned UVs; the resource does not automatically pack maps. All three channels accept ordinary Texture2D references or null, but reject CanvasTexture.
TextureFilter and TextureRepeat override resource sampling; ParentNode preserves CanvasItem inheritance. A mipmap mode does not generate the chain. Use 0…1 for ordinary SpecularShininess even if the setter retains other values. SpecularColor.a does not supply shading-parameter alpha: shininess is used instead.
Channel references, parameters, diffuse readback, clearing and independent resource reload were checked in Windows Forward+/Vulkan. Specular-map RGB/alpha roles were established from shader source. Lighting rendering, normal/specular quality, 3D and other operating systems were not established in this run.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
CanvasTextureConstructor
public CanvasTexture();Creates a resource with three empty channels, white SpecularColor, SpecularShininess = 1 and inherited filtering/repeat. The resource owns its RID; do not free it manually. Without DiffuseTexture, GetImage returns null.
Properties7
DiffuseTextureProperty
public Texture2D DiffuseTexture { get; set; }Main color texture; null by default. Its logical dimensions, HasAlpha and GetImage supply the corresponding CanvasTexture queries. Without it, dimensions are 1×1, GetImage returns null and HasAlpha returns false. Assignment retains a reference rather than a copy. This channel rejects CanvasTexture, including another instance.
NormalTextureProperty
public Texture2D NormalTexture { get; set; }Normal map for 2D lighting; null by default. It does not alter geometry, silhouette or collision and does not define CanvasTexture size. Prepare correct normal orientation and UVs aligned with the color map. Assignment does not automatically enable a light. CanvasTexture is not accepted as a map; null clears the channel.
SpecularColorProperty
public Color SpecularColor { get; set; }Specular RGB multiplier, white by default. The getter retains Color alpha, but canvas shading parameters take alpha from SpecularShininess rather than this color. This does not modulate the entire diffuse texture. Visible output depends on lighting and shader; this run checked parameter storage rather than specular appearance.
SpecularShininessProperty
public float SpecularShininess { get; set; }Specular sharpness parameter, defaulting to 1; use finite values in 0…1 for ordinary usage. Getter/setter are not clamped to the inspector hint: assigning 2 retains 2. This does not promise correct GPU output outside the range and is not 3D material roughness. SpecularTexture alpha also contributes when a map is present.
SpecularTextureProperty
public Texture2D SpecularTexture { get; set; }Specular map for 2D lighting; null by default. In the current canvas shader, RGB modulates specular color and alpha modulates shininess, multiplied by SpecularColor.rgb and SpecularShininess. This is not a 3D material metallic/roughness map. This channel rejects CanvasTexture; null clears the reference. Resource dimensions still come from DiffuseTexture.
TextureFilterProperty
public CanvasItem.TextureFilterEnum TextureFilter { get; set; }Filtering override for this CanvasTexture; defaults to CanvasItem.TextureFilterEnum.ParentNode, inheriting CanvasItem sampling. An explicit mode overrides the item baseline. Selecting a mipmap mode does not create mipmap chains in source maps. Use a valid enum value.
TextureRepeatProperty
public CanvasItem.TextureRepeatEnum TextureRepeat { get; set; }Repeat override for this CanvasTexture; defaults to CanvasItem.TextureRepeatEnum.ParentNode. Disabled disables repeating, Enabled repeats and Mirror alternates mirrored repeats. This controls texture sampling; it does not turn AtlasTexture.Region into a separate seamless image. Use a valid enum value.
Methods14
GetDiffuseTextureTexture2D
public Texture2D GetDiffuseTexture();Returns CanvasTexture.DiffuseTexture.
Texture2DCurrent DiffuseTexture value. The texture reference is shared rather than copied; it can be null.
GetNormalTextureTexture2D
public Texture2D GetNormalTexture();Returns CanvasTexture.NormalTexture.
Texture2DCurrent NormalTexture value. The texture reference is shared rather than copied; it can be null.
GetSpecularColorColor
public Color GetSpecularColor();Returns CanvasTexture.SpecularColor.
ColorCurrent SpecularColor value.
GetSpecularShininessfloat
public float GetSpecularShininess();Returns CanvasTexture.SpecularShininess.
floatCurrent SpecularShininess value.
GetSpecularTextureTexture2D
public Texture2D GetSpecularTexture();Returns CanvasTexture.SpecularTexture.
Texture2DCurrent SpecularTexture value. The texture reference is shared rather than copied; it can be null.
GetTextureFilterCanvasItem.TextureFilterEnum
public CanvasItem.TextureFilterEnum GetTextureFilter();Returns CanvasTexture.TextureFilter.
CanvasItem.TextureFilterEnumCurrent TextureFilter value.
GetTextureRepeatCanvasItem.TextureRepeatEnum
public CanvasItem.TextureRepeatEnum GetTextureRepeat();Returns CanvasTexture.TextureRepeat.
CanvasItem.TextureRepeatEnumCurrent TextureRepeat value.
SetDiffuseTexturevoid
public void SetDiffuseTexture(Texture2D texture);Sets CanvasTexture.DiffuseTexture.
| Name | Type | Default |
|---|---|---|
texture | Texture2D | — |
textureMain color Texture2D or null; CanvasTexture is rejected.
SetNormalTexturevoid
public void SetNormalTexture(Texture2D texture);Sets CanvasTexture.NormalTexture.
| Name | Type | Default |
|---|---|---|
texture | Texture2D | — |
textureNormal-map Texture2D or null; CanvasTexture is rejected.
SetSpecularColorvoid
public void SetSpecularColor(Color color);Sets CanvasTexture.SpecularColor.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorSpecular RGB multiplier; shading-parameter alpha comes from SpecularShininess.
SetSpecularShininessvoid
public void SetSpecularShininess(float shininess);Sets CanvasTexture.SpecularShininess.
| Name | Type | Default |
|---|---|---|
shininess | float | — |
shininessFinite 0…1 value for ordinary usage; the setter is not clamped to the inspector hint.
SetSpecularTexturevoid
public void SetSpecularTexture(Texture2D texture);Sets CanvasTexture.SpecularTexture.
| Name | Type | Default |
|---|---|---|
texture | Texture2D | — |
textureSpecular-map Texture2D or null; CanvasTexture is rejected.
SetTextureFiltervoid
public void SetTextureFilter(CanvasItem.TextureFilterEnum filter);Sets CanvasTexture.TextureFilter.
| Name | Type | Default |
|---|---|---|
filter | CanvasItem.TextureFilterEnum | — |
filterValid filtering mode; ParentNode inherits CanvasItem sampling.
SetTextureRepeatvoid
public void SetTextureRepeat(CanvasItem.TextureRepeatEnum repeat);Sets CanvasTexture.TextureRepeat.
| Name | Type | Default |
|---|---|---|
repeat | CanvasItem.TextureRepeatEnum | — |
repeatValid repeat mode; ParentNode inherits CanvasItem sampling.