In many cases it is desireable to be able to generate the shape of a continent or island for a game. Many methods for this exist, but few of them produce results that look similar to the quasi-randomness of real life coastlines. In this post I will introduce my favorite algorithm from DungeonLeague.com that produces very nice results.
Wednesday, March 5, 2014
Saturday, March 1, 2014
Midpoint Displacement Noise Generation
If you have done anything with Fractal Noise, you know that while it produces some of the best quality noise, it is insanely slow compared to its base functions. This is because it has to calculate a base array for every single octave. But then comes Midpoint Displacement Noise. It gives the same general look but at lightning speeds. Here's a benchmarch table from my machine:
It is so fast, it is on par with the non-fractal noise functions. This is the holy grail of fractal look-alikes.
- Fractal Interp Cubic: 670 ms
- Fractal Interp Linear: 245 ms (unacceptible quality)
- Fractal Perlin: 125 ms
- Fractal Lookup Simplex: 100 ms
- Midpoint Displacement: 24 ms
It is so fast, it is on par with the non-fractal noise functions. This is the holy grail of fractal look-alikes.
Thursday, February 27, 2014
Noise Generation Multi-Threading
Multi-threading is an extremely powerful tool at a coder's disposal, but it is devilishly hard to understand and control. Before multiple cores became common on computers, multi-threading was a way for multiple programs to run "simultaneously". In reality, the programs just took turns on the processor. But with the advent of multi-core cpus, on which actual simultaneous processing is possible, multi-threading actually gives you a significant speed increase if used correctly. In this tutorial, we will look at using multi-threading to increase the speed of noise generation. This speed boost can be significant. With noise, since almost all of the calculations can be done concurrently, you will get a speed boost similar to the number of cores you have. (I get an average of for all types of noise of 1.8 times faster on my dual-core machine)
Tuesday, February 25, 2014
Advanced Voronoi Noise Generation
The method for generating Voronoi noise in Simple Voronoi Noise Generation can only be used for groups of points. But Voronoi noise works with so much more than just points. In fact, Voronoi noise generated from other shapes can lead to some really cool effects, like these ghostly rings:
Saturday, February 22, 2014
Simple Voronoi Noise Generation
Voronoi noise is a very broad type of noise. It can look like many different things that don't seem to be related to one another. It can make the image below or (with some tweaking) it can make the background image of this website. It can make a beehive, or it can be a explosion dust cloud. It can even be used for things besides just noise. As you are probably beginning to realize, it is a very powerful tool in your noise generation arsenel.
Friday, February 21, 2014
Perlin Noise Generation
Perlin noise (named for its inventor, Ken Perlin) is very similar in appearance to interpolated noise. But in the code, it couldn't be more different. It is a lot more complicated; it has gradient maps, dot products, stuff that will make your head spin. So why not use interpolated noise, if it is so much easier? Speed. Perlin noise is a pretty good amount faster than interpolated noise. So strap on your mental seatbelts, because we're in for a wild ride.
Tuesday, February 18, 2014
Fractal Noise Generation
Fractal noise (also called fractional Brownian noise or fBm) is probably the most popular method of generating noise, and with good reason. It gives very natural and beautiful looking results, while still allowing the coder to control many aspects of it's generation. Speedwise, it is pretty average, not the fastest, but by no means the slowest either.
Here is what it looks like:
Here is what it looks like:
Monday, February 17, 2014
Interpolated Noise Generation
And now we come to the generation of interpolated noise. Interpolated Noise looks much smoother and more natural than raw noise. The basic steps of interpolating noise are simple: to find the value of a coordinate, find the nearest neighbors in the base noise array, and interpolate between them. Here are the steps are visually:
Sunday, February 16, 2014
Interpolation
In many cases, you want a smooth transition from one value to the next. This is because, jagged color changes look very unnatural. Enter interpolation. Interpolation is simply a technical term for finding intermediate values between two known values. Interpolation has many applications, from smoothing noise arrays to simple gui fade-ins. Here is what simple interpolation looks like:
Saturday, February 15, 2014
Basic Noise Generation
In order to produce more complex (and better looking) noise like Fractal Noise, it is important to have a good, robust noise generator. A noise generator is simply a random number generator that takes a seed and one or more coordinates. It must also produce the same value over and over again for a given set of inputs. Ideally, these values should be between 0 and 1, but that is not required.
Subscribe to:
Posts (Atom)