Building terrains from scratch

Instructions on building and training a customised terrain using supervised machine learning.

Last modified 2025-08-18

Jasper Shuoyang Zheng

An object nn.terrain~ 2 4 creates an empty terrain with 2 control channels and 4 latent channels.
This video introduces building a terrain with 2 continuous control channels, for an autoencoder with 4 latent dimensions.

What we need

To build a terrain from scratch, we need a training dataset: pairs of latent trajectories and spatial trajectories.

A terrain is a supervised machine learning model that learns this coordiantes-to-latents pairs, to produce new latent vectors given any coordiantes in the control space, so that the control space can be rendered as a "map" for the latent space.

Trajectories
Latent trajectories, spatial trajectories, and latent terrain.

Synopsis

Trajectories
Example can be found in the help file of `nn.terrain`.

This tutorial guides you through:

Video: