Visualizations
117 / 500

117 · Generative art

Plotter Landscape

A mountain range inked stroke by stroke, with exact floating-horizon hidden lines.

A domain-warped ridged-noise range is cut into slices at constant depth and drawn front to back, the way a pen plotter would draw it. A floating horizon, the highest point inked so far in every screen column, decides what is hidden: a slice is drawn only where it rises above that horizon, and each crossing is found by bisection, so strokes stop cleanly where they pass behind a ridge. The same horizon clips marching-squares contours and hachures drawn down the fall line and shaded by Lambert lighting. Every stroke goes to a simulated pen with a slight wobble and a dot of ink at each touch-down, and a red sun is set into the lowest notch of the finished skyline.

Try it. Drag to change the view angle (a quick proof plots while you drag). Scroll or use the minus and plus buttons to change the line density, and pick Ridgelines, Contours or Hachures. Click the sheet or press N for a new range. Keys 1 to 3 (or Space) switch plates, the left and right arrows turn the view, and up and down change the density.

  • Floating horizon hidden-line removal
  • Ridged multifractal noise
  • Marching squares
  • Hachure shading

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a pen-plotter style mountain landscape with JavaScript and the HTML canvas element, using the floating horizon algorithm for hidden line removal. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Paint it an off-white paper color.
- Write a small 2D Perlin or value noise function yourself, and a height function that adds a few octaves of it to make hills.
- Draw about 80 horizontal profile lines, front to back. Line i samples the height along x at depth z_i and is drawn at screen y = baseline(z_i) minus height times a scale, with the baseline rising for lines further away.
- Hidden line removal: keep an array with one number per pixel column, the highest point (smallest y) drawn so far. Draw each new line only where it is above that value, then update the array with the line. Because you draw front to back, everything behind a ridge disappears.
- Draw with thin dark strokes and no fill.

Once that works, make it beautiful:
- Use a perspective projection so distant lines crowd toward a horizon, and ridged noise so the far range has sharp peaks.
- Where a line crosses the horizon between two columns, find the exact crossing point so strokes end cleanly at ridges.
- Plot the lines over time instead of all at once, a few hundred pixels of ink per frame, with a tiny wobble, so you can watch it draw like a real plotter.
- Add a red sun of concentric circles behind the range, clipped by the same horizon.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as contour lines instead of profiles, hachure shading down the slopes, or exporting the strokes as SVG for a real plotter.
PreviousMandelbrot ZoomAn endless dive into the Mandelbrot set, 10^31 times deep. NextDomain ColoringDrag the zeros and poles of a complex function and count them with a loop.

Related visualizations

  • Pen PlotterGenerative art A SCARA plotter arm inks hatched, hidden-line drawings along a 2-opt optimized route.
  • Ink Landscape ScrollGenerative art An endless ink handscroll of misty peaks, pines, pavilions and boats, unrolling.
  • Topographic SurveyGenerative art Eroded terrain printed as a survey sheet with labeled contours, streams and hillshade.
  • Painterly RenderingGenerative art A harbor at dusk repainted coarse to fine in thousands of curved, bristly strokes.
  • Invented AtlasGenerative art A parchment map of a world that never was, with rivers, realms and its own language.
  • Evolved TrianglesGenerative art Two hundred translucent triangles evolve from chaos into a painted landscape.
  • Paper MarblingGenerative art Ink drops, combs and styluses on a size bath, then a print pulled onto paper.
  • Engraving Renderer3D A moving 3D still life printed as a copperplate engraving, line by swelling line.
  • Image TracerAlgorithms Pixel art and a painted landscape traced into crisp, infinitely zoomable curves.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs