INTelegance

Fractal Clouds (Diamond Square) Implementation

implemented in May 2007

Background

The Diamond Square fractal is used to efficiently generate realistic looking cloud-looking images programatically. It is commonly used in 3d graphics applications and games to generate gray scale height maps for modeling terrain.

Motivation

I implemented the Diamond Square algorithm as a component of my video installation, "Attunement". In Attunement, the fractals generated by the Diamond Square algorithm were used as height maps to create a time distortion terrain for modifying real time video. A time distortion terrain (a concept I conceived for the piece) is a grayscale image that is applied to a block of contiguous frames of a video to generate one single output frame. The white pixels of the distortion image map to pixels from frames in the future and the dark pixels map to pixels of frames further in the past. All grayscale values between are interpolated to there closest frame from the block. By using the cloud fractals as my distortion maps, I was able to obtain diverse and graphically engaging output video in the Attunement project.

The source code for diamond square is implemented in the Java language using the Processing graphics environment. Feel free to use, modify, or redistribute the code freely. A detail external description of the algorithm (and where I initially encountered it) can be found at Game Programmer's "Generating Random Fractal Terrain" article.

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.