PcoWSkbVqDnWTu_dm2ix

Generating Terrain with Heightmaps

Generating Terrain with Heightmaps

5 min

Roblox Studio lets you import heightmaps and colormaps to automatically generate terrain. Imported maps generate biomes with structures similar to terrain that you generate in Studio, as described in /articles/Intro To Terrain|Environments and Terrain Tools.

A heightmap is a 2D representation of a 3D terrain map, as viewed directly from above. Brighter areas of a heightmap result in higher terrain like mountains, while darker areas result in lower regions like valleys.

Heightmap
Generated Terrain

A colormap specifies terrain materials like grass or ice when importing a heightmap. Based on the colors “painted” on the image file, Roblox generates terrain of the corresponding type.

Colormap
Generated Terrain

Guidelines

Follow these guidelines and restrictions for best results when using heightmaps and colormaps.

Scaling

  • Terrain is built on a system of voxels and 1 voxel has dimensions of 4×4×4 studs. Importer settings are in studs.
  • When importing a heightmap or colormap, the default scaling factor is 1 pixel = 1 voxel = 4 studs. For example, a heightmap with a 5×5 pixel square will create a 20×20 stud square on the terrain.
  • If you provide map dimensions at a different scale, Roblox scales and smooths the map to respect these dimensions. If you want sharp edges or steep drop-off in your terrain, stay close to the default scaling factor.

Heightmaps

  • Use .jpg or .png formats (8-bit or 16-bit). For best results, use 16-bit .png.
  • A maximum of 4096×4096 pixels are supported.
  • 1 pixel in a heightmap represents 4 studs.

Colormaps

  • Save your colormap in the sRGB color profile. For best results, download the RobloxColorMapIndex file and sample colors directly from it, or type the exact RGB values into the color picker of your image editing application.
  • Use hard edges when painting a colormap. Anti-aliasing or edge smoothing creates pixels outside the expected RGB material settings range.
  • The following table describes the RGB mapping to their corresponding material. If your colormap contains a color that’s not in the table, Roblox chooses the closest matching material.
Color RGB Value Material
[255, 255, 255] Air
[115, 123, 107] Asphalt
[30, 30, 37] Basalt
[138, 86, 62] Brick
[132, 123, 90] Cobblestone
[127, 102, 63] Concrete
[232, 156, 74] CrackedLava
[101, 176, 234] Glacier
[106, 127, 63] Grass
[102, 92, 59] Ground
[129, 194, 224] Ice
[115, 132, 74] LeafyGrass
[206, 173, 148] Limestone
[58, 46, 36] Mud
[148, 148, 140] Pavement
[102, 108, 111] Rock
[198, 189, 181] Salt
[143, 126, 95] Sand
[137, 90, 71] Sandstone
[63, 127, 107] Slate
[195, 199, 218] Snow
[139, 109, 79] WoodPlanks
[12, 84, 92] Water

Importing a Heightmap

To import a heightmap in Studio:

  1. Open the Terrain Editor.
  1. From the Create tab, click the Import button.
  1. In the Map Settings section, click the blank square in the Heightmap section to select an image.
  2. Optionally enter X, Y, and Z values for Position (the center of the generated terrain) and Size (in studs).
  1. In the Material Settings section, select the material or colormap that you want to generate terrain with.
  • To use a material, click the Material button and select a default material.
  • To use a colormap, click the Colormap button and click the blank square to select a colormap.
  1. Click the Generate button to create the terrain.
Tags:
  • terrain
  • heightmap
  • colormap