S
Image To STL
How It Works

What Is Heightmap 3D Conversion?

The science behind turning pixel brightness into real 3D depth — explained simply.

April 13, 2026  ·  5 min read

When you upload an image to a tool like imagetostl.net and download a 3D model a few seconds later, something surprisingly clever has happened behind the scenes. The tool used a technique called heightmap conversion to translate the visual information in your 2D image into geometric 3D data. Here is exactly how it works.

What Is a Heightmap?

A heightmap is a grayscale image where the brightness of each pixel represents a height value rather than a color value. Think of it like a topographic map: just as a map uses contour lines to show elevation, a heightmap uses shades of gray to encode how high or low each point on a surface should be.

In a standard heightmap:

  • White (brightness = 255) represents the highest point
  • Black (brightness = 0) represents the lowest point
  • Gray values in between represent proportional heights

Heightmaps have been used in computer graphics for decades — most famously in video games to generate realistic terrain from simple textures. The rolling hills in your favorite open-world game almost certainly started life as a grayscale heightmap.

How Image-to-STL Conversion Uses Heightmaps

When you upload a color image (PNG or JPG) to an image-to-STL converter, the tool first converts your image to grayscale. This step maps the visual luminance (perceived brightness) of every pixel into a single brightness value between 0 and 255.

Each pixel in the grayscale image now corresponds to a point on a 2D grid. The converter then takes each pixel's brightness value and uses it to determine the height of that point in 3D space. A bright pixel becomes a tall point; a dark pixel becomes a short one. This grid of heights is called a height field.

Once the height field is generated, the algorithm connects all the height points with triangular faces to build a continuous 3D surface mesh. A flat base is added underneath, and the result is exported as an STL file — a printable 3D model that reflects the light and dark patterns of your original image as physical raised and recessed areas.

In short: bright pixels become hills, dark pixels become valleys. Your image becomes a landscape.

The Role of the Max Height Setting

The "Max Height" setting in the converter controls the vertical scale of the 3D model. It defines how tall the brightest (whitest) pixel in your image will be in the final model, measured in millimeters.

For example, if you set Max Height to 5mm and your image has a pure white area, that area will become a 5mm tall peak in the model. A 50% gray area would become approximately 2.5mm tall. This linear mapping between brightness and height is what makes heightmap conversion so predictable and controllable.

What Is the Invert Height Option?

Sometimes your image has a dark subject on a white background — a black logo on white paper, for instance. Without inversion, the white background would become the tallest part of the model, and your subject would be recessed. The "Invert Height" option flips this relationship so that dark areas become tall and bright areas become flat. This is the right setting whenever your main subject is darker than the background.

Why Some Images Convert Better Than Others

Heightmap conversion works best with images that have strong tonal contrast — a wide range of brightness values that clearly define the subject. Images that convert well include:

  • High-contrast logos and icons
  • Black-and-white line art and illustrations
  • Coin and medallion designs
  • Simple portrait silhouettes
  • Text on a clean background

Images that are harder to convert include low-contrast photographs, images with many similar mid-tone values, and very detailed images where fine detail may be lost in the mesh resolution.

What Does Smoothing Do?

Raw heightmap conversion can produce sharp, pixelated edges — especially along the borders of bright and dark regions. The smoothing setting applies a blur pass to the height field before building the mesh, softening the transitions between height levels. This reduces the staircase effect and creates more natural-looking curves, which is particularly useful for organic shapes like faces, animals, and landscapes.

For sharp geometric designs like logos and text, use low smoothing (or none at all) to preserve crisp edges. For portraits and organic forms, a moderate smoothing level produces far better results.

Heightmaps Beyond 3D Printing

Heightmap techniques are used far beyond 3D printing. Game engines use heightmaps to generate large terrain meshes efficiently. Normal mapping in real-time graphics uses a related concept to simulate surface detail without adding geometry. CNC machining and laser engraving tools also use height data derived from images to carve physical surfaces. The core idea — using 2D image data to drive 3D geometry — is a foundational concept across the entire field of computer graphics and digital fabrication.

See it in action

Try converting an image now and watch the heightmap turn into a real 3D model in seconds.

Open the Converter →