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...
SpriteBase3D¶
Inherits: GeometryInstance3D < VisualInstance3D < Node3D < Node < Object
Inherited By: AnimatedSprite3D, Sprite3D
2D sprite node in 3D environment.
Description¶
A node that displays 2D texture information in a 3D environment. See also Sprite3D where many other properties are defined.
Properties¶
|
||
|
||
|
||
|
||
|
||
Vector3.Axis |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
generate_triangle_mesh ( ) const |
|
get_draw_flag ( DrawFlags flag ) const |
|
get_item_rect ( ) const |
|
void |
set_draw_flag ( DrawFlags flag, bool enabled ) |
Enumerations¶
enum DrawFlags:
DrawFlags FLAG_TRANSPARENT = 0
If set, the texture's transparency and the opacity are used to make those parts of the sprite invisible.
DrawFlags FLAG_SHADED = 1
If set, lights in the environment affect the sprite.
DrawFlags FLAG_DOUBLE_SIDED = 2
If set, texture can be seen from the back as well. If not, the texture is invisible when looking at it from behind.
DrawFlags FLAG_DISABLE_DEPTH_TEST = 3
Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
DrawFlags FLAG_FIXED_SIZE = 4
Label is scaled by depth so that it always appears the same size on screen.
DrawFlags FLAG_MAX = 5
Represents the size of the DrawFlags enum.
enum AlphaCutMode:
AlphaCutMode ALPHA_CUT_DISABLED = 0
This mode performs standard alpha blending. It can display translucent areas, but transparency sorting issues may be visible when multiple transparent materials are overlapping.
AlphaCutMode ALPHA_CUT_DISCARD = 1
This mode only allows fully transparent or fully opaque pixels. Harsh edges will be visible unless some form of screen-space antialiasing is enabled (see ProjectSettings.rendering/anti_aliasing/quality/screen_space_aa). On the bright side, this mode doesn't suffer from transparency sorting issues when multiple transparent materials are overlapping. This mode is also known as alpha testing or 1-bit transparency.
AlphaCutMode ALPHA_CUT_OPAQUE_PREPASS = 2
This mode draws fully opaque pixels in the depth prepass. This is slower than ALPHA_CUT_DISABLED or ALPHA_CUT_DISCARD, but it allows displaying translucent areas and smooth edges while using proper sorting.
AlphaCutMode ALPHA_CUT_HASH = 3
This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque.
Property Descriptions¶
float alpha_antialiasing_edge = 0.0
Threshold at which antialiasing will be applied on the alpha channel.
AlphaAntiAliasing alpha_antialiasing_mode = 0
void set_alpha_antialiasing ( AlphaAntiAliasing value )
AlphaAntiAliasing get_alpha_antialiasing ( )
The type of alpha antialiasing to apply. See AlphaAntiAliasing.
AlphaCutMode alpha_cut = 0
void set_alpha_cut_mode ( AlphaCutMode value )
AlphaCutMode get_alpha_cut_mode ( )
The alpha cutting mode to use for the sprite. See AlphaCutMode for possible values.
float alpha_hash_scale = 1.0
The hashing scale for Alpha Hash. Recommended values between 0
and 2
.
float alpha_scissor_threshold = 0.5
Threshold at which the alpha scissor will discard values.
Vector3.Axis axis = 2
void set_axis ( Vector3.Axis value )
Vector3.Axis get_axis ( )
The direction in which the front of the texture faces.
BillboardMode billboard = 0
void set_billboard_mode ( BillboardMode value )
BillboardMode get_billboard_mode ( )
The billboard mode to use for the sprite. See BillboardMode for possible values.
bool centered = true
If true
, texture will be centered.
bool double_sided = true
If true
, texture can be seen from the back as well, if false
, it is invisible when looking at it from behind.
bool fixed_size = false
If true
, the label is rendered at the same size regardless of distance.
bool flip_h = false
If true
, texture is flipped horizontally.
bool flip_v = false
If true
, texture is flipped vertically.
Color modulate = Color(1, 1, 1, 1)
A color value used to multiply the texture's colors. Can be used for mood-coloring or to simulate the color of light.
Note: If a GeometryInstance3D.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, BaseMaterial3D.vertex_color_use_as_albedo must be true
. For a ShaderMaterial, ALBEDO *= COLOR.rgb;
must be inserted in the shader's fragment()
function.
bool no_depth_test = false
If true
, depth testing is disabled and the object will be drawn in render order.
Vector2 offset = Vector2(0, 0)
The texture's drawing offset.
float pixel_size = 0.01