Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Label3D

Inherits: GeometryInstance3D < VisualInstance3D < Node3D < Node < Object

A node for displaying plain text in 3D space.

Description

A node for displaying plain text in 3D space. By adjusting various properties of this node, you can configure things such as the text's appearance and whether it always faces the camera.

Tutorials

Properties

float

alpha_antialiasing_edge

0.0

AlphaAntiAliasing

alpha_antialiasing_mode

0

AlphaCutMode

alpha_cut

0

float

alpha_hash_scale

1.0

float

alpha_scissor_threshold

0.5

AutowrapMode

autowrap_mode

0

BillboardMode

billboard

0

ShadowCastingSetting

cast_shadow

0 (overrides GeometryInstance3D)

bool

double_sided

true

bool

fixed_size

false

Font

font

int

font_size

32

GIMode

gi_mode

0 (overrides GeometryInstance3D)

HorizontalAlignment

horizontal_alignment

1

BitField<JustificationFlag>

justification_flags

163

String

language

""

float

line_spacing

0.0

Color

modulate

Color(1, 1, 1, 1)

bool

no_depth_test

false

Vector2

offset

Vector2(0, 0)

Color

outline_modulate

Color(0, 0, 0, 1)

int

outline_render_priority

-1

int

outline_size

12

float

pixel_size

0.005

int

render_priority

0

bool

shaded

false

StructuredTextParser

structured_text_bidi_override

0

Array

structured_text_bidi_override_options

[]

String

text

""

Direction

text_direction

0

TextureFilter

texture_filter

3

bool

uppercase

false

VerticalAlignment

vertical_alignment

1

float

width

500.0

Methods

TriangleMesh

generate_triangle_mesh ( ) const

bool

get_draw_flag ( DrawFlags flag ) const

void

set_draw_flag ( DrawFlags flag, bool enabled )


Enumerations

enum DrawFlags:

DrawFlags FLAG_SHADED = 0

If set, lights in the environment affect the label.

DrawFlags FLAG_DOUBLE_SIDED = 1

If set, text can be seen from the back as well. If not, the text is invisible when looking at it from behind.

DrawFlags FLAG_DISABLE_DEPTH_TEST = 2

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 = 3

Label is scaled by depth so that it always appears the same size on screen.

DrawFlags FLAG_MAX = 4

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. GeometryInstance3D.cast_shadow has no effect when this transparency mode is used; the Label3D will never cast shadows.

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). This mode is also known as alpha testing or 1-bit transparency.

Note: This mode might have issues with anti-aliased fonts and outlines, try adjusting alpha_scissor_threshold or using MSDF font.

Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline.

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.

Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline.

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

  • void set_alpha_antialiasing_edge ( float value )

  • float get_alpha_antialiasing_edge ( )

Threshold at which antialiasing will be applied on the alpha channel.


AlphaAntiAliasing alpha_antialiasing_mode = 0

The type of alpha antialiasing to apply. See AlphaAntiAliasing.


AlphaCutMode alpha_cut = 0

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


float alpha_hash_scale = 1.0