APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)

Thursday, June 5, 2008

Procedural textures

Yesterday I talked about the different ways the programmer can draw in a texture. Today it's the time of the libraries that define procedural textures, that are those textures useful to generate natural looking surfaces without using real images. Below you can see several examples of textures generated by the TxSynth library included in APOCALYX. The screenshot is taken from the TextureGenerator.lua demo included in DemoPack1.

As you can notice, tuning different parameters, one can generate portions of the Mandelbrot set, wood, marble, cloudy skies, fire or plasma, bricks and so on. Spending a few seconds of CPU time, the programmer can save a lot of memory, because there is no need to store and read large images, instead the images are generated on the fly according to the specified requests. Thanks to the TxSynth library, the procedure is fast and the results are quite good.
Another library with similar characteristics is the "noise" library. Using particular algorithms, among which the famous Perlin noise, several kind of images can be generated.

The screenshot above shows a terrain generated by the "noise" library from the Flying Circus demo. A characteristics that differentiates this library from TxSynth is the capability to generate colored textures with shadows, in fact grayscale images can be interpreted by the library as heights from which the shadows are computed. This feature is very useful during the creation of terrains, in particular when the programmer specifies that the image must be seamless: in this case the APOCALYX engine can render very large or, better, infinite terrains, every time different, because their textures are generated at random.

No comments: