← Pixel Dreamer Studio

Only 8 lights show on a long wall in Compatibility

One mesh takes 8 lights. Build long walls and floors from pieces.

Split the wall into shorter meshes, so that fewer than 8 lights reach each one. The Compatibility renderer, which web exports use, lights each mesh with at most 8 lights: rendering/limits/opengl/max_lights_per_object was 8 in our project. In our Godot 4.7 test 12 lights along one 20 m wall lit only the middle 8 spots. The two at each end left the wall black, brightness 0.03 against 1.0. The same wall built by the script below from 10 pieces showed all 12.

A row of pink, cyan and yellow light spots on a dark wall, twice. On the left only 8 spots show, with empty wall at both ends. On the right all 12 show
Godot 4.7 with the Compatibility renderer. Left: one 20 m wall mesh. Right: the same wall in 10 pieces from the script below.

The code

Use this node in place of a long wall or floor mesh and set material. piece is the length of each part: with lights 1.5 m apart, 2 m pieces are each reached by only a few. The same idea works for walls you model yourself: cut long walls and floors into parts before you import them.

extends Node3D
## Builds a long wall out of short pieces, so no single mesh is touched by too many lights.
## The Compatibility renderer (and so web exports) lights each mesh with at most 8 lights:
## on one long wall with a row of signs, the ninth light and beyond do not show at all.

@export var length := 20.0
@export var height := 3.0
@export var thickness := 0.2
@export var piece := 2.0  ## metres per piece. Keep fewer than 8 lights reaching each piece
@export var material: Material


func _ready() -> void:
	var n := ceili(length / piece)
	var w := length / n
	for i in n:
		var m := MeshInstance3D.new()
		var b := BoxMesh.new()
		b.size = Vector3(w, height, thickness)
		m.mesh = b
		m.material_override = material
		m.position = Vector3(-length * 0.5 + (i + 0.5) * w, height * 0.5, -thickness * 0.5)
		add_child(m)

What we measured

Twelve OmniLight3Ds 1.5 m apart, 0.5 m in front of a white wall 20 m long, each reaching 0.9 m. We read the wall's brightness straight in front of each light, from 0 to 1.

Two runs gave the same numbers.

Why the end of the wall goes dark

In the Compatibility renderer each mesh is drawn with a short list of the lights that touch it, and the list holds 8. When more lights than that touch one long mesh, the extra ones are left out for the whole mesh, so a stretch of wall stays dark with a light right in front of it. In our test the lights left out were the ones furthest from the middle of the wall. Smaller meshes each touch only the lights near them, so every light lands on some piece.

What to change

Ready-made neon: Neon Signs & Area Lights for Godot 4.7 has 41 3D neon signs and light fixtures, including OPEN, BAR, HOTEL, RAMEN and ARCADE signs, icons, tube bars, paper lanterns and string lights, each lighting the wall and the wet ground around it.

Tested in Godot 4.7 with the Compatibility renderer.

Ready-made: Neon Signs & Area Lights for Godot 4.7 has 41 ready-made 3D neon signs and light fixtures that light the walls and wet ground around them, including OPEN, BAR, HOTEL and RAMEN signs, paper lanterns and string lights.

More how-tos for Neon Signs & Area Lights for Godot 4.7: A swing that settles the same at any frame rate

More how-tos: Shaders, materials and lights