Sunday, 28 June 2015

GSoC Week 2 : Adding Noise Functions for creating Procedural Terrain

This week is all about implementation of different noise functions in Heightmap class. I have covered the basic implementation of a noise function earlier and also added the c bindings. This week I will be extending my work by implementing Simplex Noise. I will be writing a detailed blog on an explanation on the Simplex Noise algorithm but here I will just go through the work that I did so far.

Basically I added two main functions that will generate noise based on the Simplex Noise algorithm. One is raw noise function that will calculate the noise from the simplex grid and return a value between -1 and 1. Other function is octave noise which will add multiple passes of raw noise with higher frequency and lower amplitude in each successive pass. The noise functions are adapted from Stefan Gustavson's implementation of Simplex Noise.


Here is the screenshot for the final output that is generated by the noise functions. The above terrain is created by applying ten octaves of Simplex noise with frequency being doubled and amplitude being reduced to half at each successive pass. Though results are not satisfactory for now, but they are reasonable enough to move on to the next milestone that will use the terrain.

To sum it up, the current API call for generating landscape using pseudo random noise function is soy.textures.Heightmap(texture_width, texture_height, frequency). Here increasing frequency means that more gradient points are added in the free space which are then normalized to give a look of a smooth terrain. I am still working on it and will keep adding improvements to it.

No comments:

Post a Comment