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

AlphaCutMode

alpha_cut

0

Vector3.Axis

axis

2

BillboardMode

billboard

0

bool

centered

true

bool

double_sided

true

bool

flip_h

false

bool

flip_v

false

Color

modulate

Color(1, 1, 1, 1)

Vector2

offset

Vector2(0, 0)

float

opacity

1.0

float

pixel_size

0.01

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:

  • FLAG_TRANSPARENT = 0 --- If set, the texture's transparency and the opacity are used to make those parts of the sprite invisible.

  • FLAG_SHADED = 1 --- If set, lights in the environment affect the sprite.

  • 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.

  • FLAG_MAX = 3 --- Represents the size of the DrawFlags enum.


enum 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.

  • 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.

  • 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.

Property Descriptions

Default

0

Setter

set_alpha_cut_mode(value)

Getter

get_alpha_cut_mode()

The alpha cutting mode to use for the sprite. See AlphaCutMode for possible values.


  • Vector3.Axis axis

Default

2

Setter

set_axis(value)

Getter

get_axis()

The direction in which the front of the texture faces.


Default

0

Setter

set_billboard_mode(value)

Getter

get_billboard_mode()

The billboard mode to use for the sprite. See BillboardMode for possible values.


Default

true

Setter

set_centered(value)

Getter

is_centered()

If true, texture will be centered.


Default

true

Setter

set_draw_flag(value)

Getter

get_draw_flag()

If true, texture can be seen from the back as well, if false, it is invisible when looking at it from behind.


Default

false

Setter

set_flip_h(value)

Getter

is_flipped_h()

If true, texture is flipped horizontally.


Default

false

Setter

set_flip_v(value)

Getter

is_flipped_v()

If true, texture is flipped vertically.


Default

Color(1, 1, 1, 1)

Setter

set_modulate(value)

Getter

get_modulate()

A color value that gets multiplied on, could be used for mood-coloring or to simulate the color of light.


Default

Vector2(0, 0)

Setter

set_offset(value)

Getter

get_offset()

The texture's drawing offset.


Default

1.0

Setter

set_opacity(value)

Getter

get_opacity()

The objects' visibility on a scale from 0 fully invisible to 1 fully visible.


Default

0.01

Setter

set_pixel_size(value)

Getter

get_pixel_size()

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


Default

false

Setter

set_draw_flag(value)

Getter

get_draw_flag()

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


Default

true

Setter

set_draw_flag(value)

Getter

get_draw_flag()

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

Method Descriptions

Returns a TriangleMesh with the sprite's vertices following its current configuration (such as its axis and pixel_size).


Returns the value of the specified flag.


  • Rect2 get_item_rect ( ) const

Returns the rectangle representing this sprite.


If true, the specified flag will be enabled. See DrawFlags for a list of flags.