← Pixel Dreamer Studio

Dark horror fog that works in Compatibility

Regular fog with a near-black color. Volumetric fog does not draw in Compatibility.

Use the Environment's regular fog and set fog_light_color to nearly black. In our Godot 4.7 test with the Compatibility renderer, turning fog on with its defaults made a near-black background come out light grey (brightness 0.559), because the default fog color is a light grey-blue. With the script below the background stayed dark (0.022) and white pillars faded with distance: 0.84 at 5 m, 0.70 at 10 m, 0.49 at 20 m and 0.23 at 40 m.

The same corridor of pillars twice. Left: the far end and the sky are pale grey. Right: the far end and the sky fade into black
Godot 4.7 with the Compatibility renderer. Left: fog turned on with its default settings. Right: the script below.

The code

Use this as your scene's WorldEnvironment, or copy the settings in _ready() into your own Environment. density sets how far you can see. fog_color is also used for the background, so the sky disappears into the same dark.

extends WorldEnvironment
## Dark fog for horror scenes that also works in the Compatibility renderer (and web exports).
## Far things and the sky fade into darkness instead of into grey mist.
## Use this as your scene's WorldEnvironment, or copy the settings in _ready() into yours.

@export var fog_color := Color(0.02, 0.025, 0.03)  ## nearly black, so far things fade to dark
@export var density := 0.08  ## higher = you see less far


func _ready() -> void:
	if not environment:
		environment = Environment.new()
	var e := environment
	e.background_mode = Environment.BG_COLOR
	e.background_color = fog_color  # the sky disappears into the same dark
	e.fog_enabled = true
	e.fog_mode = Environment.FOG_MODE_EXPONENTIAL
	e.fog_light_color = fog_color  # the default is a light grey-blue, which glows in a dark scene
	e.fog_sun_scatter = 0.0
	e.fog_density = density

What we measured

Four white, unshaded pillars at 5, 10, 20 and 40 m. We read the brightness in the middle of each pillar, the average of red, green and blue from 0 to 1.

Two runs gave the same numbers.

Why the default fog looks wrong in the dark

Fog blends each pixel toward fog_light_color, and it covers the background as well. The default color is a daytime haze, so in a dark scene the end of a corridor and the sky turn pale grey instead of black. With the fog color close to your darkest background, distance fades to dark. Volumetric fog is no way around this on the web: the Compatibility renderer does not draw it at all, see god rays without volumetric fog.

What to change

Ready-made horror effects: Horror Atmosphere VFX for Godot 4 has 45 presets in Modern and Retro PSX looks, including Ground Fog, Creeping Mist, flickering and dying bulbs, a dying flashlight, glowing eyes and ghosts.

Tested in Godot 4.7 with the Compatibility renderer.

Ready-made: Horror Atmosphere VFX for Godot 4 has 45 ready-made horror effects in Modern and Retro PSX looks, including Ground Fog, Creeping Mist, flickering and dying bulbs, a dying flashlight, glowing eyes and ghosts.

More how-tos for Horror Atmosphere VFX for Godot 4: Play random sounds and events without obvious repeats · A scare that plays once, and only for the player

More how-tos: Auras, rings, beams and weather