Environment
The environment controls ambient lighting, the sky background, HDRI maps, and fog. Access it via scene.environment.
local env = scene.environmentAmbient Lighting
Section titled “Ambient Lighting”Ambient light is a uniform base illumination applied to all surfaces.
env.ambient_color = { r = 0.1, g = 0.1, b = 0.1 } -- defaultenv.ambient_intensity = 0.3 -- defaultHDRI Environment Map
Section titled “HDRI Environment Map”Load an HDR image for image-based lighting and reflections:
env.hdri = "environments/studio.hdr" -- path to .hdr or .exrenv.hdri_rotation = 90 -- degrees, rotate the map around Yenv.hdri_intensity = 1.0 -- brightness multiplierSet env.hdri = nil to clear the environment map.
HDRI is currently stubbed — values are stored but not rendered yet.
Sky Modes
Section titled “Sky Modes”The sky determines what’s rendered behind the scene. Three modes are available:
env.sky_mode = "color" -- "color" | "gradient" | "hdri"Solid Color
Section titled “Solid Color”env.sky_mode = "color"env.sky_color = { r = 0.05, g = 0.05, b = 0.15 }Gradient
Section titled “Gradient”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 }HDRI Sky
Section titled “HDRI Sky”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 = trueenv.fog_mode = "linear" -- "linear" | "exponential" | "exp2"env.fog_color = { r = 0.5, g = 0.6, b = 0.7 }Linear Fog
Section titled “Linear Fog”env.fog_mode = "linear"env.fog_start = 10 -- distance where fog beginsenv.fog_end = 100 -- distance where fog is fully opaqueExponential Fog
Section titled “Exponential Fog”env.fog_mode = "exponential" -- or "exp2" for squared falloffenv.fog_density = 0.02Fog is currently stubbed — values are stored but not rendered yet.
Full Example: Dark Stage
Section titled “Full Example: Dark Stage”local env = scene.environment
-- Dark ambientenv.ambient_color = { r = 0.02, g = 0.02, b = 0.05 }env.ambient_intensity = 0.15
-- Dark gradient skyenv.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 hazeenv.fog_enabled = trueenv.fog_mode = "exponential"env.fog_color = { r = 0.05, g = 0.05, b = 0.1 }env.fog_density = 0.01