Perlin Noise: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 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 | 2 | ||
| 3 | 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 | 4 | ||
| 5 | 5 | ## Getting Started | |
| 6 | 6 | ||
| 7 | 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 | 8 | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 9 | + |  | |
| 13 | 10 | ||
| 14 | 11 | ## First Example | |
| 15 | 12 | ||
| 16 | 13 | This application demonstrates a simple noise function with the following properties: | |
| 17 | 14 | ||
| 18 | 15 | - Only 1 harmonic present | |
| 19 | 16 | - Amplitude of 250 pixels | |
| 20 | 17 | - Wavelength of 20 pixels | |
| 21 | 18 | - Frequency of 0.05 | |
| 22 | 19 | - You can use a combo box to choose between Linear, Cossine and Cubic interpolation | |
| 23 | 20 | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 21 | + |  | |
| 28 | 22 | ||
| 29 | 23 | Files: | |
| 30 | 24 | ||
| 31 | 25 | - noise1d.lpi | |
| 32 | 26 | - noise1d.dpr | |
| 33 | 27 | - noise.pas | |
| 34 | 28 | ||
| 35 | 29 | ## Persistence Example | |
| 36 | 30 | ||
| 37 | 31 | This application demonstrates how to sum many noise functions to get a perlin noise function. It has the following properties: | |
| 38 | 32 | ||
| 39 | 33 | - 3 harmonics present | |
| 40 | 34 | - Amplitudes of 250, 125 and 62 pixels | |
| 41 | 35 | - Wavelength of 20, 10, and 5 pixels | |
| 42 | 36 | - Frequency of 0.05, 0.1, 0.2 | |
| 43 | 37 | - You can use a combo box to choose between Linear, Cossine and Cubic interpolation | |
| 44 | 38 | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 39 | + |  | |
| 49 | 40 | ||
| 50 | 41 | Files: | |
| 51 | 42 | ||
| 52 | 43 | - perlin1d.lpi | |
| 53 | 44 | - perlin1d.dpr | |
| 54 | 45 | - noise.pas | |
| 55 | 46 | ||
| 56 | 47 | ## Use Perlin noise to create textures | |
| 57 | 48 | ||
| 58 | 49 | It is possible to create tilable textures of stone, water, wood... with Perlin noise. | |
| 59 | 50 | ||
| 60 | 51 | Here is a tutorial on how to do this: [[BGRABitmap tutorial 8]] | |
| 61 | 52 | ||
| 62 | 53 | ## Subversion | |
| 63 | 54 | ||
| 64 | 55 | You can download the source code for the examples and the library using this command: | |
| 65 | 56 | ||
| 66 | 57 | svn co <https://svn.code.sf.net/p/lazarus-ccr/svn/examples/noise> noise | |
| 67 | 58 | ||
| 68 | 59 | ## External Links | |
| 69 | 60 | ||
| 70 | 61 | - [Article](http://web.archive.org/web/20160325134143/http://freespace.virgin.net/hugo.elias/models/m_perlin.htm) with the theory of Perlin Noise. | |
| 71 | 62 | ||
| 72 | 63 | --- | |
| 73 | 64 | *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 | 65 | Category: Game Development | |
| 75 | 66 | Category: Graphics | |
| 76 | 67 | Category: Lazarus-CCR | |
| 77 | 68 | Category: SciTech | |
| 78 | 69 | Category: Tutorials |
