#### <sup>[Ollin](../../../index.md) → [Examples](../../index.md) → [3D](../index.md) → Raymarching</sup>

---

## Raymarching

| [![RaymarchedCastShadow](https://media.ollin.art/examples/3D/Raymarching/RaymarchedCastShadow/still-640.jpg?v=55fc1d64)](raymarchedcastshadow.md) | [![RaymarchedClay](https://media.ollin.art/examples/3D/Raymarching/RaymarchedClay/still-640.jpg?v=73230297)](raymarchedclay.md) | [![RaymarchedDetailing](https://media.ollin.art/examples/3D/Raymarching/RaymarchedDetailing/still-640.jpg?v=130026b5)](raymarcheddetailing.md) | [![RaymarchedDistort](https://media.ollin.art/examples/3D/Raymarching/RaymarchedDistort/still-640.jpg?v=9235b361)](raymarcheddistort.md) |
|---|---|---|---|
| [RaymarchedCastShadow](raymarchedcastshadow.md) | [RaymarchedClay](raymarchedclay.md) | [RaymarchedDetailing](raymarcheddetailing.md) | [RaymarchedDistort](raymarcheddistort.md) |
| [![RaymarchedDomain](https://media.ollin.art/examples/3D/Raymarching/RaymarchedDomain/still-640.jpg?v=24977fec)](raymarcheddomain.md) | [![RaymarchedEnvironment](https://media.ollin.art/examples/3D/Raymarching/RaymarchedEnvironment/still-640.jpg?v=c516361d)](raymarchedenvironment.md) | [![RaymarchedFractals](https://media.ollin.art/examples/3D/Raymarching/RaymarchedFractals/still-640.jpg?v=07604853)](raymarchedfractals.md) | [![RaymarchedGradient](https://media.ollin.art/examples/3D/Raymarching/RaymarchedGradient/still-640.jpg?v=7a536ac3)](raymarchedgradient.md) |
| [RaymarchedDomain](raymarcheddomain.md) | [RaymarchedEnvironment](raymarchedenvironment.md) | [RaymarchedFractals](raymarchedfractals.md) | [RaymarchedGradient](raymarchedgradient.md) |
| [![RaymarchedJoinery](https://media.ollin.art/examples/3D/Raymarching/RaymarchedJoinery/still-640.jpg?v=74cccab4)](raymarchedjoinery.md) | [![RaymarchedPlane](https://media.ollin.art/examples/3D/Raymarching/RaymarchedPlane/still-640.jpg?v=ccc330cb)](raymarchedplane.md) | [![RaymarchedRadial](https://media.ollin.art/examples/3D/Raymarching/RaymarchedRadial/still-640.jpg?v=ccfadddc)](raymarchedradial.md) | [![RaymarchedReceiveShadow](https://media.ollin.art/examples/3D/Raymarching/RaymarchedReceiveShadow/still-640.jpg?v=2dea073a)](raymarchedreceiveshadow.md) |
| [RaymarchedJoinery](raymarchedjoinery.md) | [RaymarchedPlane](raymarchedplane.md) | [RaymarchedRadial](raymarchedradial.md) | [RaymarchedReceiveShadow](raymarchedreceiveshadow.md) |
| [![RaymarchedSDF](https://media.ollin.art/examples/3D/Raymarching/RaymarchedSDF/still-640.jpg?v=e88f18cd)](raymarchedsdf.md) | [![RaymarchedSculpt](https://media.ollin.art/examples/3D/Raymarching/RaymarchedSculpt/still-640.jpg?v=f3374cb3)](raymarchedsculpt.md) | [![RaymarchedShadow](https://media.ollin.art/examples/3D/Raymarching/RaymarchedShadow/still-640.jpg?v=53d7a72f)](raymarchedshadow.md) | [![RaymarchedShapes](https://media.ollin.art/examples/3D/Raymarching/RaymarchedShapes/still-640.jpg?v=b2df734b)](raymarchedshapes.md) |
| [RaymarchedSDF](raymarchedsdf.md) | [RaymarchedSculpt](raymarchedsculpt.md) | [RaymarchedShadow](raymarchedshadow.md) | [RaymarchedShapes](raymarchedshapes.md) |
| [![RaymarchedStretch](https://media.ollin.art/examples/3D/Raymarching/RaymarchedStretch/still-640.jpg?v=c0911f44)](raymarchedstretch.md) |  |  |  |
| [RaymarchedStretch](raymarchedstretch.md) |  |  |  |

This group covers the 3D SDF combinators: distance fields that merge, sphere-traced beside the meshes.

| Sketch | What it shows |
| --- | --- |
| [RaymarchedSDF](raymarchedsdf.md) | The 3D SDF combinators sphere-traced as one surface. Spheres melt together by smooth-union, and their colors blend through the seam. One sphere orbits, and a bite is carved out by subtraction. |
| [RaymarchedShapes](raymarchedshapes.md) | The raymarched primitive catalog beyond the first four (rounded box, cylinder, cone, octahedron, ellipsoid). Each is a field traced into the shared depth buffer. |
| [RaymarchedSculpt](raymarchedsculpt.md) | The scoped block form. Inside `smoothUnion(k:) { … }`, bare mesh calls (`drawSphere`, `drawCapsule`, `drawCone`, …) are captured as fields and melt into one traced surface. |
| [RaymarchedDomain](raymarcheddomain.md) | Domain operators. `repeated(spacing:count:)` tiles a unit cell into a finite lattice, and `mirrored(x:y:z:)` folds one built lobe into a symmetric form. The whole thing stays one surface. |
| [RaymarchedRadial](raymarchedradial.md) | Polar repetition. `repeatedRadially` folds one wedge into an evenly spaced rosette around an axis, with no draw cost per copy. |
| [RaymarchedPlane](raymarchedplane.md) | The infinite plane leaf. An unbounded ground is merged into the field and marched to the far plane, and it catches the shapes' soft shadows. |
| [RaymarchedStretch](raymarchedstretch.md) | Per-axis sizing. `stretched` is exact elongation, so a sphere becomes a capsule. Beside it, `scaled(x:y:z:)` is a true non-uniform scale, marched conservatively. |
| [RaymarchedGradient](raymarchedgradient.md) | Gradient paint on a merged field. A gradient `fill` paints the whole sphere-traced surface, sampled at each hit's projected screen position. |
| [RaymarchedEnvironment](raymarchedenvironment.md) | Raymarched fields lit by an environment. They get the same image-based lighting and traced reflections the meshes get. |
| [RaymarchedShadow](raymarchedshadow.md) | A field shadowing itself under `castShadows()`. A soft penumbra is marched toward the light and evaluated as part of the surface shading. |
| [RaymarchedCastShadow](raymarchedcastshadow.md) | A field casting a shadow onto meshes under a directional or point light (any key switches). Either the field renders into the 2D shadow map, or the lit mesh fragments march the field inline toward the light. |
| [RaymarchedReceiveShadow](raymarchedreceiveshadow.md) | A field receiving a mesh's cast shadow under a directional or point light (any key switches). The traced surface samples the 2D map, the shadow cube, or the acceleration structure at its hit. |
| [RaymarchedClay](raymarchedclay.md) | The sculpt block. The combine mode and melt amount are held as state, so a form reads top to bottom like working clay. |
| [RaymarchedJoinery](raymarchedjoinery.md) | Machined joints and hardware: chamfered and stepped unions, a hanging chain, a capped-torus hook. |
| [RaymarchedDetailing](raymarcheddetailing.md) | The detailing ops: fluted seams, engraved rings, grooved bands, beading, and a pipe bead left hanging where two bodies crossed. |
| [RaymarchedDistort](raymarcheddistort.md) | The sculpting distortions: twisted, bent, displaced, and roughened, one plinth each. |
| [RaymarchedFractals](raymarchedfractals.md) | The fractal leaves: a Mandelbulb, a Menger sponge, and a Mandelbox. Each is a distance estimate that the same sphere tracer draws. A menu picks one, and the bulb's power, the sponge's depth, and the box's scale are each a parameter of their own. |

Run one with `swift run Example-3D-Raymarching-<Name>`, for example `swift run Example-3D-Raymarching-RaymarchedSDF`.
