Class SpriteBase3D
2D sprite node in 3D environment.
- Inheritance
-
SpriteBase3D
- Derived
Remarks
A node that displays 2D texture information in a 3D environment. See also Sprite3D where many other properties are defined.
Properties
alpha_antialiasing_edge
Threshold at which antialiasing will be applied on the alpha channel.
var alpha_antialiasing_edge : float = 0.0
Property Value
Remarks
alpha_antialiasing_mode
The type of alpha antialiasing to apply. See AlphaAntiAliasing.
var alpha_antialiasing_mode : int = 0
Property Value
Remarks
alpha_cut
The alpha cutting mode to use for the sprite. See AlphaCutMode for possible values.
var alpha_cut : int = 0
Property Value
Remarks
alpha_hash_scale
The hashing scale for Alpha Hash. Recommended values between 0
and 2
.
var alpha_hash_scale : float = 1.0
Property Value
Remarks
alpha_scissor_threshold
Threshold at which the alpha scissor will discard values.
var alpha_scissor_threshold : float = 0.5
Property Value
Remarks
axis
The direction in which the front of the texture faces.
var axis : int = 2
Property Value
Remarks
billboard
The billboard mode to use for the sprite. See BillboardMode for possible values.
Note: When billboarding is enabled and the material also casts shadows, billboards will face the camera in the scene when rendering shadows. In scenes with multiple cameras, the intended shadow cannot be determined and this will result in undefined behavior. See GitHub Pull Request #72638 for details.
var billboard : int = 0
Property Value
Remarks
centered
If true
, texture will be centered.
var centered : bool = true
Property Value
Remarks
double_sided
If true
, texture can be seen from the back as well, if false
, it is invisible when looking at it from behind.
var double_sided : bool = true
Property Value
Remarks
fixed_size
If true
, the label is rendered at the same size regardless of distance.
var fixed_size : bool = false
Property Value
Remarks
flip_h
If true
, texture is flipped horizontally.
var flip_h : bool = false
Property Value
Remarks
flip_v
If true
, texture is flipped vertically.
var flip_v : bool = false
Property Value
Remarks
modulate
A color value used to multiply the texture's colors. Can be used for mood-coloring or to simulate the color of ambient light.
Note: Unlike modulate for 2D, colors with values above 1.0
(overbright) are not supported.
Note: If a material_override is defined on the SpriteBase3D, the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in modulate will be ignored. For a BaseMaterial3D, vertex_color_use_as_albedo must be true
. For a ShaderMaterial, ALBEDO *= COLOR.rgb;
must be inserted in the shader's fragment()
function.
var modulate : Color = Color(1, 1, 1, 1)
Property Value
Remarks
no_depth_test
If true
, depth testing is disabled and the object will be drawn in render order.
var no_depth_test : bool = false
Property Value
Remarks
offset
The texture's drawing offset.
var offset : Vector2 = Vector2(0, 0)
Property Value
Remarks
pixel_size
The size of one pixel's width on the sprite to scale it in 3D.
var pixel_size : float = 0.01
Property Value
Remarks
render_priority
Sets the render priority for the sprite. Higher priority objects will be sorted in front of lower priority objects.
Note: This only applies if alpha_cut is set to SpriteBase3D.ALPHA_CUT_DISABLED (default value).
Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
var render_priority : int = 0
Property Value
Remarks
shaded
If true
, the Light3D in the Environment has effects on the sprite.
var shaded : bool = false
Property Value
Remarks
texture_filter
Filter flags for the texture. See TextureFilter for options.
Note: Linear filtering may cause artifacts around the edges, which are especially noticeable on opaque textures. To prevent this, use textures with transparent or identical colors around the edges.
var texture_filter : int = 3
Property Value
Remarks
transparent
If true
, the texture's transparency and the opacity are used to make those parts of the sprite invisible.
var transparent : bool = true
Property Value
Remarks
Methods
generate_triangle_mesh
Qualifiers: const
Returns a TriangleMesh with the sprite's vertices following its current configuration (such as its axis and pixel_size).
TriangleMesh generate_triangle_mesh
get_draw_flag(int)
Qualifiers: const
Returns the value of the specified flag.
bool get_draw_flag(int flag)
Parameters
flag
int
get_item_rect
Qualifiers: const
Returns the rectangle representing this sprite.
Rect2 get_item_rect
set_draw_flag(int, bool)
If true
, the specified flag will be enabled. See DrawFlags for a list of flags.
void set_draw_flag(int flag, bool enabled)