Quick answer: Set no_depth_test = false to respect geometry depth. For nameplates that should always be visible but sort correctly relative to each other, use render_priority. For a constant on-screen size, enable fixed_size. Billboard mode determines which axes the label rotates on.

Here is how to fix Godot Label3D render depth wrong. You place a Label3D over an enemy’s head to show its name. The enemy walks behind a wall and the name is still visible, floating through the wall. Or you have dozens of nameplates and they flicker against each other. Godot’s Label3D ships with a set of defaults optimized for “always visible” UI-style labels, which is wrong for most in-world labeling.

The Symptom

A Label3D renders on top of everything regardless of world position. A text label placed at (0,0,0) shows over a wall at z = -10. Multiple Label3Ds at similar positions z-fight or blink. Adding a Camera3D at different angles shows labels popping in and out unexpectedly.

Variant: the label occludes correctly against some meshes but not others; or it respects depth in the editor but ignores it at runtime.

What Causes This

no_depth_test defaults to true. Label3D sets no_depth_test = true out of the box, which disables the depth buffer test for this object. It paints over anything regardless of Z. This is fine for UI overlays but wrong for world labels.

Transparent rendering bin. Text uses alpha blending, so Label3D lands in the transparent render bin. Transparent objects sort by distance to camera, not by z-buffer. Two close labels can z-fight unless one has a higher render_priority.

Billboard mode misalignment. With billboard = BILLBOARD_ENABLED, the label rotates each frame to face the camera. The bounding box changes shape, and cached culling info may be stale, producing pop-in.

fixed_size rescales after world scale. With fixed_size = true, the label is projected to screen and scaled so it is always N pixels tall. A label at z = -100 and z = -1 render at the same apparent size. Without depth test, both show at full alpha.

Outline rendering. Label3D outlines use a separate material. If you set no_depth_test on the text but not the outline (or vice versa), you get half-occluded labels where the outline clips but the text does not.

The Fix

Step 1: Turn off no_depth_test for world labels.

extends Label3D

func _ready():
    no_depth_test = false
    fixed_size = true
    billboard = BaseMaterial3D.BILLBOARD_FIXED_Y
    text = "Goblin (HP 24)"

With no_depth_test = false, the label respects the depth buffer. Walls in front of it occlude it. Behind it, other geometry is drawn correctly.

Step 2: Use render_priority for sorting. Even with depth test on, transparent objects at the same position sort by render_priority. Higher priority draws last (on top). For nameplates that should always be on top of trees but behind UI:

name_label.render_priority = 1      # above world
damage_number.render_priority = 2   # above names

Range is typically -128 to 127. Use small integers; large jumps are not necessary.

Step 3: Pick the right billboard mode. Three options:

For character nameplates, BILLBOARD_FIXED_Y is usually correct. Full billboard looks unnatural when you tilt the camera.

Step 4: Keep fixed_size on for readability. Without fixed_size, distant labels shrink to illegibility. With it on, the label occupies a constant pixel height and remains readable regardless of camera distance. Combine with pixel_size to tune the apparent text size:

label.pixel_size = 0.005   # smaller number = smaller label

Visibility Through Walls (On Purpose)

Sometimes you want labels visible through walls — for example, marking quest NPCs through fog of war. Use two Label3Ds on the same node: one opaque with no_depth_test = false for the normal case, one translucent with no_depth_test = true and lower alpha for the see-through case:

func _ready():
    $NameNormal.no_depth_test = false
    $NameNormal.modulate.a = 1.0

    $NameGhost.no_depth_test = true
    $NameGhost.modulate.a = 0.35
    $NameGhost.render_priority = -1

The ghost pass draws behind, so when the normal pass is occluded the ghost bleeds through faintly.

Outline Sync

Label3D’s outline_size renders the text with an outline. The outline respects the same depth-test flag as the main text, so they will occlude together. If you customize via StandardMaterial3D on the generated mesh, make sure depth settings are matched on both passes.

“no_depth_test = true is UI mode. For world labels, you almost always want it off.”

Related Issues

For 3D scene setup generally, see CharacterBody3D Wall Slide Jitter. For broader rendering questions, Viewport Mouse Position Offset covers related display topics.

no_depth_test off, fixed_size on, billboard fixed Y, render_priority for sorting. Labels occlude right.