Environment API

Lighting, material, sky, fog, effects, and presets.

Environment

set_sun_direction

function

Sets the direction of the sun light.

set_sun_direction(x: f64, y: f64, z: f64)
set_sun_direction(1.0, 1.0, 0.5)

set_sun_color

function

Sets the color of the sun light.

set_sun_color(r: f64, g: f64, b: f64)
set_sun_color(1.0, 0.9, 0.8)

set_sun_intensity

function

Sets the sun brightness multiplier.

set_sun_intensity(intensity: f64)
set_sun_intensity(1.5)

set_ambient_color

function

Sets the ambient light color.

set_ambient_color(r: f64, g: f64, b: f64)
set_ambient_color(0.1, 0.1, 0.15)

set_ambient_intensity

function

Sets the ambient light brightness multiplier.

set_ambient_intensity(intensity: f64)
set_ambient_intensity(0.8)

set_material_color

function

Sets the base material color.

set_material_color(r: f64, g: f64, b: f64)
set_material_color(0.8, 0.2, 0.1)

set_material_color_hex

function

Sets the base material color from a hex string.

set_material_color_hex(hex: string)
set_material_color_hex("#cc5533")

set_material_shininess

function

Sets material shininess.

set_material_shininess(shininess: f64)
set_material_shininess(16.0)

set_specular_intensity

function

Sets specular highlight strength.

set_specular_intensity(intensity: f64)
set_specular_intensity(0.4)

set_sky_horizon

function

Sets the sky color near the horizon.

set_sky_horizon(r: f64, g: f64, b: f64)
set_sky_horizon(0.7, 0.8, 0.9)

set_sky_zenith

function

Sets the sky color at the zenith.

set_sky_zenith(r: f64, g: f64, b: f64)
set_sky_zenith(0.3, 0.5, 0.8)

set_background_color

alias

Compatibility alias that sets both sky horizon and zenith colors.

set_background_color(r: f64, g: f64, b: f64)
set_background_color(0.1, 0.1, 0.12)

Alias for set_sky_horizon + set_sky_zenith.

set_fog_color

function

Sets the fog color.

set_fog_color(r: f64, g: f64, b: f64)
set_fog_color(0.6, 0.65, 0.7)

set_fog_density

function

Sets fog density.

set_fog_density(density: f64)
set_fog_density(0.02)

set_ao_enabled

function

Enables or disables ambient occlusion.

set_ao_enabled(enabled: bool)
set_ao_enabled(true)

set_ao_intensity

function

Sets ambient occlusion strength.

set_ao_intensity(intensity: f64)
set_ao_intensity(1.5)

set_shadows_enabled

function

Enables or disables shadows.

set_shadows_enabled(enabled: bool)
set_shadows_enabled(true)

set_shadow_softness

function

Sets shadow softness.

set_shadow_softness(softness: f64)
set_shadow_softness(0.2)

rgb_hex

function

Converts a hex color string to normalized RGB values.

rgb_hex(hex: string) -> array
let color = rgb_hex("#ff5500");

env_default

alias

Resets environment settings to the default.

env_default()
env_default()

Alias for Environment::default.

env_studio

preset

Applies clean studio lighting.

env_studio()
env_studio()

env_sunset

preset

Applies warm sunset lighting.

env_sunset()
env_sunset()

env_night

preset

Applies cool night lighting.

env_night()
env_night()

env_daylight

preset

Applies daylight lighting.

env_daylight()
env_daylight()

env_clay

preset

Applies a clay material studio preset.

env_clay()
env_clay()