Effects














This group covers the scene-wide realism passes over the 3D frame.
| Sketch | What it shows |
|---|---|
| SceneDefocus | Depth of field on a 3D scene, defocused by its own depth buffer. A row of orbs is drawn into a render target, then scene.combined(with: scene.depth, .defocus(...)) racks focus through them. Drag to rack focus by hand. |
| AmbientOcclusion | Screen-space ambient occlusion from the scene's own depth and normals. It adds the soft darkening in crevices and contact gaps that grounds a brightly lit scene. |
| ScreenSpaceReflections | Surfaces reflecting the scene around them. SSR is traced over the frame and shown on a ring of reflective spheres in different metal finishes. |
| RayTracedReflections | Metals mirroring the actual scene, off-screen geometry included and with none of SSR's streaks. Rough surfaces spread their rays for a glossy result, and there is a reflectionBounces parameter. Needs a ray-tracing GPU and an environment. |
| ContactShadows | The fine dark seam that seats an object on the surface it stands on. |
| Atmosphere | Fog as a cue for distance and height, and physical aerial perspective, both over one colonnade. Hold space to switch. |
| Volumes | A column of smoke drawn from a box of density samples, rising past a ball whose shadow cuts a shaft down through it. The medium parameter turns it to cloud, fire, ink, or a glowing nebula. |
| MotionBlur | The streak a real camera's open shutter leaves on something moving. |
| TemporalAA | Edges refined past MSAA by accumulating jittered frames. |
| SpecularAntialias | Highlights smaller than their pixel, held still instead of crawling. |
| Upscaling | The frame is rendered small and reconstructed at full size, which keeps the frame rate up. |
| FrameInterpolation | The sketch draws half as often, and a generated frame between each pair lets the display keep its rate. |
| LensFlare | The light a camera adds to a picture on its own. |
| PathTraced | Tune the scene live, then render the same frame offline with a path tracer. |
Run one with swift run Example-3D-Effects-<Name>, for example swift run Example-3D-Effects-SceneDefocus.