All work

Generative models

GanScape

A GAN that turns a segmentation mask into a height map, which I then render as 3D terrain.

  • Python
  • PyTorch
  • NumPy
  • SciPy

Techniques: Attention U-Net, PatchGAN, Spectral norm, AMP, PyVista

View the code
A height map generated by GanScape, rendered as relief
A height map generated by GanScape, rendered as relief
Height maps generated by the model, rendered as relief maps.

The problem

Sculpting terrain by hand is slow. GanScape learns the mapping from a simple segmentation mask to a height map with believable detail, so a rough layout becomes a landscape you can render in 3D.

How I built it

  1. 01An attention-gated U-Net generator translates segmentation masks into height maps, with a PatchGAN discriminator judging local realism.
  2. 02Spectral normalization and instance normalization keep adversarial training stable; mixed-precision (AMP) training speeds up convergence.
  3. 03OpenSimplex adds fractal detail, SciPy filters the output, and PyVista renders it as a 3D surface.
Next projectPest detection on a Raspberry PiOpen