Ambient light

Watch the ground farthest from the lamp as you raise ambient light. Can you reveal it without moving the lamp?
Interactive demo#LightAndGlowINSIDE
The base brightness everything gets, even where no light reaches.
It sets the mood before any lamps are placed. High ambient is a sunny day; low ambient is a cave where only the torch matters. Drag the slider from midnight to noon.
Code
namespace ambient_light_lesson;
import stage;
import std;
import math;
export "ambient-light" fn draw(time: f64, dt: f64, px: f64, py: f64, hover: bool) {
let ambient = number_control("ambient", 0.3);
lit_scene();
draw_prop("lantern", 100, MY + 4, 8, 16);
darkness(0.95 * (1 - ambient), 104, MY + 12, 30 + sin(time * 11) * 1.5);
}

Comments
No comments yet.