Skip to content

Environment

The environment controls ambient lighting, the sky background, HDRI maps, and fog. Access it via scene.environment.

local env = scene.environment

Ambient light is a uniform base illumination applied to all surfaces.

env.ambient_color = { r = 0.1, g = 0.1, b = 0.1 } -- default
env.ambient_intensity = 0.3 -- default

Load an HDR image for image-based lighting and reflections:

env.hdri = "environments/studio.hdr" -- path to .hdr or .exr
env.hdri_rotation = 90 -- degrees, rotate the map around Y
env.hdri_intensity = 1.0 -- brightness multiplier

Set env.hdri = nil to clear the environment map.

HDRI is currently stubbed — values are stored but not rendered yet.

The sky determines what’s rendered behind the scene. Three modes are available:

env.sky_mode = "color" -- "color" | "gradient" | "hdri"
env.sky_mode = "color"
env.sky_color = { r = 0.05, g = 0.05, b = 0.15 }

A vertical gradient from top to bottom:

env.sky_mode = "gradient"
env.sky_top = { r = 0.05, g = 0.05, b = 0.15 }
env.sky_bottom = { r = 0.02, g = 0.02, b = 0.05 }

Use the loaded HDRI as the sky background:

env.sky_mode = "hdri"
env.hdri = "environments/sunset.hdr"

Fog blends distant objects toward a fog color, creating depth and atmosphere.

env.fog_enabled = true
env.fog_mode = "linear" -- "linear" | "exponential" | "exp2"
env.fog_color = { r = 0.5, g = 0.6, b = 0.7 }
env.fog_mode = "linear"
env.fog_start = 10 -- distance where fog begins
env.fog_end = 100 -- distance where fog is fully opaque
env.fog_mode = "exponential" -- or "exp2" for squared falloff
env.fog_density = 0.02

Fog is currently stubbed — values are stored but not rendered yet.

local env = scene.environment
-- Dark ambient
env.ambient_color = { r = 0.02, g = 0.02, b = 0.05 }
env.ambient_intensity = 0.15
-- Dark gradient sky
env.sky_mode = "gradient"
env.sky_top = { r = 0.01, g = 0.01, b = 0.03 }
env.sky_bottom = { r = 0, g = 0, b = 0 }
-- Light haze
env.fog_enabled = true
env.fog_mode = "exponential"
env.fog_color = { r = 0.05, g = 0.05, b = 0.1 }
env.fog_density = 0.01