SpriteBase3D

Inherits: GeometryInstance < VisualInstance < CullInstance < Spatial < Node < Object

Inherited By: AnimatedSprite3D, Sprite3D

2D sprite node in 3D environment.

Description

A node that displays 2D texture information in a 3D environment.

Properties

AlphaCutMode

alpha_cut

0

Vector3.Axis

axis

2

BillboardMode

billboard

0

bool

centered

true

bool

double_sided

true

bool

fixed_size

false

bool

flip_h

false

bool

flip_v

false

Color

modulate

Color( 1, 1, 1, 1 )

bool

no_depth_test

false

Vector2

offset

Vector2( 0, 0 )

float

opacity

1.0

float

pixel_size

0.01

int

render_priority

0

bool

shaded

false

bool

transparent

true

Methods

TriangleMesh

generate_triangle_mesh ( ) const

bool

get_draw_flag ( DrawFlags flag ) const

Rect2

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, it 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

Sprite 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

AlphaCutMode ALPHA_CUT_DISCARD = 1

AlphaCutMode ALPHA_CUT_OPAQUE_PREPASS = 2


Property Descriptions

AlphaCutMode alpha_cut = 0

There is currently no description for this property. Please help us by contributing one!


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

There is currently no description for this property. Please help us by contributing one!


bool centered = true

  • void set_centered ( bool value )

  • bool is_centered ( )

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

  • void set_flip_h ( bool value )

  • bool is_flipped_h ( )

If true, texture is flipped horizontally.


bool flip_v = false

  • void set_flip_v ( bool value )

  • bool is_flipped_v ( )

If true, texture is flipped vertically.


Color modulate = Color( 1, 1, 1, 1 )

  • void set_modulate ( Color value )

  • Color get_modulate ( )

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 GeometryInstance.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 SpatialMaterial, SpatialMaterial.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 opacity = 1.0

  • void set_opacity ( float value )

  • float get_opacity ( )

The texture's visibility on a scale from 0 (fully invisible) to 1 (fully visible). opacity is a multiplier for the modulate color's alpha channel.

Note: If a GeometryInstance.material_override is defined on the SpriteBase3D, the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in opacity will be ignored. For a SpatialMaterial, SpatialMaterial.vertex_color_use_as_albedo must be true. For a ShaderMaterial, ALPHA *= COLOR.a; must be inserted in the shader's fragment() function.


float pixel_size = 0.01

  • void set_pixel_size ( float value )

  • float get_pixel_size ( )

The size of one pixel's width on the sprite to scale it in 3D.


int render_priority = 0

  • void set_render_priority ( int value )

  • int get_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 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).


bool shaded = false

If true, the Light in the Environment has effects on the sprite.


bool transparent = true

If true, the texture's transparency and the opacity are used to make those parts of the sprite invisible.


Method Descriptions

TriangleMesh generate_triangle_mesh ( ) const

There is currently no description for this method. Please help us by contributing one!


bool get_draw_flag ( DrawFlags flag ) const

Returns the value of the specified flag.


Rect2 get_item_rect ( ) const

Returns the rectangle representing this sprite.


void set_draw_flag ( DrawFlags flag, bool enabled )

If true, the specified flag will be enabled.