Perlin Noise

Perlin noise has various uses in games. Below you can see some of the applications in action, and download implementations in Python, Java, and Game Maker’s Language. Read the article in Dev.Mag (issue 20) that explains how to implement Perlin noise, and how you can use it in your games.

Applications

Texture Generation Using Gradient Mapping

perlin_noise_gradient_grey perlin_noise_gradient_fire3 perlin_noise_gradient_map
perlin_noise_gradient_wood perlin_noise_gradient_clouds perlin_noise_gradient_discrete_map

Interesting Transitions

imf_10 imf_00 imn_5
Original image1 Original image 2 High contrast
Perlin noise.
Plant Growth threshold smooth_threshold
Blend Sharp Threshold Sigmoid Threshold

Landscape Generation

landscape_noise landscape_mesh Default_Pass_Main.1

Tile Placement

screenshot121

Animation

clouds clouds2  

Download

Python Implementation

Contains functions for generating 2D and 3D Perlin noise.

The demo outputs images in text format. These can be converted to PNGs with a converter.

Java Implementation

Contains functions for generating 2D Perlin noise.

Game Maker

This Game Maker file contains functions for generating 2D Perlin noise, and a simple demo that uses Perlin noise to lay tiles to build a procedural world.

screenshot0_gmk screenshot1_gmk screenshot2_gmk

Links

Atkins, M.; Barad H.; Gerlitz, O.; Goehring, D. Real-Time Procedural Texturing Techniques Using MMX.

http://www.gamasutra.com/view/feature/3098/a_realtime_procedural_universe_.php

More texture generating techniques using Perlin noise.


Elias, H. Perlin Noise. http://freespace.virgin.net/hugo.elias/models/m_perlin.htmA very good introduction to Perlin noise.


Gustavson, S. Simplex noise demystified. http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdfExplains classic Perlin noise, and an improvement thereof (simplex noise). The treatment is technical, but comes with very readable source code.


Perlin, K. Makin Noise. http://www.noisemachine.com/talk1/The creator of Perlin noise’s website.


Zucker, M. The Perlin noise math FAQ. http://www.cs.cmu.edu/~mzucker/code/perlin-noise-math-faq.htmlA deeper look into the mathematics of Perlin noise.

Tags: , ,

4 Responses to “Perlin Noise”

  1. Anton Says:

    Hi,

    Nice article and very tidy code, but you did not publish it with
    some sort of license. Can i assume its free to use and redistribute?
    Your terms&conditions link does not work too :/

  2. Herman Tulleken Says:

    Thanks for pointing out the link bug; it is now fixed :-) However, it is mostly relevant to the animation content and game content - not the code placed here.

    The code is under the IDRC (I don’t really care) license: use it, redistribute it, sell it, whatever. [I may roll versions of this code into proper open source projects, in which case the license will be more explicit]. It is provided for educational purposes, and is not meant as production code.

  3. herman.tulleken Says:

    The Python code for this tutorial is now maintained here:

    http://code-spot.co.za/python-image-code/

  4. code-spot · A simple texture algorithm – faster code and more results Says:

    […] The texture is also suitable for organic blend animations (compare with organic blending using Perlin noise). […]

Leave a Reply