Perlin Noise: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Perlin Noise
| Old | New | Line | |
|---|---|---|---|
| 1 | + | This page is the start of a tutorial about using Perlin Noise on LCL applications to generate natural looking images. It will cover both basic theory and real usage examples, with a focus on compilable examples. | |
| 2 | + | ||
| 3 | + | Perlin Noise was invented by [Ken Perlin](http://mrl.nyu.edu/~perlin/) to generate textures for a movie called Tron. Today it is widely used on movies and video games to produce natural looking smoke, landscapes, clouds and any texture including marble, irregular glass, etc. | |
| 4 | + | ||
| 5 | + | ## Getting Started | |
| 6 | + | ||
| 7 | + | Perlin Noise is based on the idea of fractals, that things in nature show different degrees of change. On a rocky mountain landscape for example when can see changes with a very big amplitude, which are the mountains themselves. Smaller changes represent irregularities on those mountains and even smaller ones represent rocks. | |
| 8 | + | ||
| 9 | + | <figure> | |
| 10 | + | <img src="mountain_landscape.png" title="mountain_landscape.png" /> | |
| 11 | + | <figcaption>mountain_landscape.png</figcaption> | |
| 12 | + | </figure> | |
| 13 | + | ||
| 14 | + | ## First Example | |
| 15 | + | ||
| 16 | + | This application demonstrates a simple noise function with the following properties: | |
| 17 | + | ||
| 18 | + | - Only 1 harmonic present | |
| 19 | + | - Amplitude of 250 pixels | |
| 20 | + | - Wavelength of 20 pixels | |
| 21 | + | - Frequency of 0.05 | |
| 22 | + | - You can use a combo box to choose between Linear, Cossine and Cubic interpolation | |
| 23 | + | ||
| 24 | + | <figure> | |
| 25 | + | <img src="Noise1D.png" title="Noise1D.png" /> | |
| 26 | + | <figcaption>Noise1D.png</figcaption> | |
| 27 | + | </figure> | |
| 28 | + | ||
| 29 | + | Files: | |
| 30 | + | ||
| 31 | + | - noise1d.lpi | |
| 32 | + | - noise1d.dpr | |
| 33 | + | - noise.pas | |
| 34 | + | ||
| 35 | + | ## Persistence Example | |
| 36 | + | ||
| 37 | + | This application demonstrates how to sum many noise functions to get a perlin noise function. It has the following properties: | |
| 38 | + | ||
| 39 | + | - 3 harmonics present | |
| 40 | + | - Amplitudes of 250, 125 and 62 pixels | |
| 41 | + | - Wavelength of 20, 10, and 5 pixels | |
| 42 | + | - Frequency of 0.05, 0.1, 0.2 | |
| 43 | + | - You can use a combo box to choose between Linear, Cossine and Cubic interpolation | |
| 44 | + | ||
| 45 | + | <figure> | |
| 46 | + | <img src="Perlin1D.png" title="Perlin1D.png" /> | |
| 47 | + | <figcaption>Perlin1D.png</figcaption> | |
| 48 | + | </figure> | |
| 49 | + | ||
| 50 | + | Files: | |
| 51 | + | ||
| 52 | + | - perlin1d.lpi | |
| 53 | + | - perlin1d.dpr | |
| 54 | + | - noise.pas | |
| 55 | + | ||
| 56 | + | ## Use Perlin noise to create textures | |
| 57 | + | ||
| 58 | + | It is possible to create tilable textures of stone, water, wood... with Perlin noise. | |
| 59 | + | ||
| 60 | + | Here is a tutorial on how to do this: [[BGRABitmap tutorial 8]] | |
| 61 | + | ||
| 62 | + | ## Subversion | |
| 63 | + | ||
| 64 | + | You can download the source code for the examples and the library using this command: | |
| 65 | + | ||
| 66 | + | svn co <https://svn.code.sf.net/p/lazarus-ccr/svn/examples/noise> noise | |
| 67 | + | ||
| 68 | + | ## External Links | |
| 69 | + | ||
| 70 | + | - [Article](http://web.archive.org/web/20160325134143/http://freespace.virgin.net/hugo.elias/models/m_perlin.htm) with the theory of Perlin Noise. | |
| 71 | + | ||
| 72 | + | --- | |
| 73 | + | *From the Free Pascal wiki, page "Perlin Noise", as it stood on 2019-04-11 after a change by PascalR, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 74 | + | Category: Game Development | |
| 75 | + | Category: Graphics | |
| 76 | + | Category: Lazarus-CCR | |
| 77 | + | Category: SciTech | |
| 78 | + | Category: Tutorials |
