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 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.
- No fog: 1.000 at every distance.
- Fog turned on with its defaults (
fog_density0.01,fog_light_color0.518, 0.553, 0.608): 0.986, 0.970, 0.941 and 0.889. The near-black background read 0.559. - The script (density 0.08, color 0.02, 0.025, 0.03): 0.839, 0.702, 0.490 and 0.230. The background read 0.022.
- Height fog:
fog_height0.8 withfog_height_density0.6 made no difference between 0.2 m and 1.6 m up the pillar 10 m away (0.702 both).fog_height3 with density 8 made everything below 3 m almost black at every distance, 0.029 already at 5 m: a flat dark layer, not mist that builds up with distance. The script leaves height fog off.
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
density: raise it for a tight corridor where you should see only a few metres, lower it for an open graveyard.fog_color: a hint of green or blue changes the mood. Keep it about as dark as your darkest background.- For mist that creeps along the floor, use soft particle puffs near the ground instead of height fog, and turn on Proximity Fade so they do not cut into the floor.
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
- Light shaft cards without the bright edge-on line
- Stretch a bolt sprite from the caster to the target
- Space lights, posts or coins evenly along a Path3D
- Stop a big spinning texture from looking grainy when it is drawn small
- God rays without volumetric fog
- Magic aura particles that circle a character
- Charge-up particles that fly in to the middle
- Particle ring standing up instead of flat
- 2D particles from a sprite's shape
- A glowing circle on the ground
- A loot beam that never goes flat
- Chain lightning between enemies
- A tower's attack range ring
- Enemy vision cone with a "!" when it spots you
- Rain that follows the camera
- Rain falling through the roof
- Snow particles not falling
- orbit_velocity not working in 3D: use tangential_accel
- Rain falls through the player
- Snow that stays on roofs
- Emit particles along a Path3D
- Ambient particles in many places from one emitter
- Keep a buff aura on until the last buff really runs out
- Spin a magic circle forever at the same speed
- Space flying swords, shields or orbs evenly around a character for any count
- Text around a circle with even gaps