Marching Squares / Visualising Scalar Fields

Visualising Scalar Fields : Introduction

June 15, 2016

Tags: , , , , , , , , , , , , , , ,

Source code for all demos in this post can be found here.
Demos have been created using Unity. If you’re new to Unity, it’s free to use and can be downloaded from the Unity website here.

What are Scalar Fields?

A scalar field is a grid of values, created by sampling a certain thing at a regular intervals. Imagine a patch of ground, 8m x 8m in size. If we record the height of that ground at points 1m apart, we might produce something similar to scalar field below:

Screen Shot 2016-06-16 at 16.47.10

Scalar fields can be difficult to read on their own, so it’s useful to visualise the data in a more accessible way. One such way is to use Isolines and Isosurfaces: visualisations that group points in the scalar field with the same threshold values. The scalar field in the last image is used again in the image below, but this time blue isolines (also known as contour lines) join threshold values of 0, 10, 20, 30 and 40, allowing us to easily visualise the height across the sampled ground.

Screen Shot 2016-06-16 at 16.49.25

Example of a scalar field sampling height of an area (with added contour lines from threshold values of 0, 10, 20, 30 and 40). Picture from












Isolines are a 2D visualisation because all points on the line have the same (threshold) value.

The images below shows how a scalar field of height samples might be visualised using isosurfaces, as well as isolines. An isosurface fills the area equal and above a given threshold value, creating a surface representation for that threshold. For instance, the bright yellow isosurface represents all points with a value above 250 (overlayed by the brown isosurfaces of higher threshold value). Isosurfaces can be both 2D (left visualisation) or 3D (right visualisation).

Screen Shot 2016-06-16 at 16.49.32

The above contour maps have 10 different isolines with threshold values of 50 to 500. Images from

Screen Shot 2016-06-16 at 16.49.38




Next : Visualising Scalar Fields : Marching Squares Part 1 : Contour Map



Your email address will not be published.