Environments
This group covers image-based lighting, with HDRIs that are bundled, downloaded, loaded from a URL, or synthesized.
| Sketch | What it shows |
|---|---|
| ImageBasedLighting | environment(_:) lights the scene from an HDRI, so physically-based metals fill in with real reflections instead of reading near-black. The same environment also serves as the skybox backdrop. |
| EnvironmentGallery | The eight bundled CC0 HDRI environments (studio, courtyard, forest, interior, city, sunrise, sunset, night) stepped through over one PBR still life. They advance on their own, or you can step with the arrow keys. |
| RemoteEnvironment | Environments fetched from the web: a sharper 2K/4K/8K backdrop for a bundled environment (highResolution(_:)), or any equirectangular HDRI URL (Environment.hdri(downloadURL:)). Each is downloaded once and cached. Any key switches. |
| ProceduralSky | A daylight dome with no asset. environment(.sky(...)) synthesizes a physically-based sky at runtime and sweeps its sun through a full day. |
| Cloudscape | A raymarched cloudscape over the procedural sky. |
| LiveEnvironment | A live camera environment: the room the sketch is in lights the scene. |
Run one with swift run Example-3D-Environments-<Name>, for example swift run Example-3D-Environments-ImageBasedLighting.





