Jump to content
  • Advertisement
Sign in to follow this  

Procedural textures and fractals

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wanted to do Procedural textures as my project at Uni and emailed one of my lecturers if he knew anything about them. He replied by saying that Procedural textures sounds like fractals, or mathematical functions (the latter are used for 3D textures where you can’t just store an image). What is the difference between fractals and Procedural textures? Are they ever used in games for example?

Share this post

Link to post
Share on other sites
Fractals can be used to generate procedural textures, but not all procedural textures are fractal in nature. 'Mathematical function' matches more closely with the notion of a procedural texture, but it's difficult to draw a genuine parallel, as the two terms arise in very different fields and are studied differently.

A fractal is any geometric form that is self-similar with regards to scaling. The mathematical concept of a fractal pivots on an object being indistinguishable when viewed from two different scales. By induction, this means that the object is infinite in magnitude and will appear the same under arbitrary magnification or minification. The idiomatic definition is much looser. For example, a tree could be described as a (finite) fractal, as its twigs resemble its branches which resemble its trunk. Other examples in nature include snowflakes, coastlines and lung infrastructure.

A procedural texture is any digital image (usually two-dimensional, but not necessarily) that is defined by a generating-algorithm, rather than an array of pixels. As very simple example in pseudo-C would be:

Colour ProceduralPeriodicGradient(int x, int y) {
Colour pixel;
pixel.red = 0.0;
pixel.green = 1.0;
pixel.blue = (float) x / 100.0;
return pixel;
Here, we describe the colour of any pixel in terms of its coordinates by means of an algorithm/procedure (hence we have defined it procedurally). Using this function, we can create the texture as a bitmap without ever having to store hard pixel values.

It would be very difficult to write a procedure to generate an image of, say, a telephone, but much easier to create a lunar terrain. Many patterns in nature are generated by physical processes and so they can often be neatly described in an algorithm. Notably, many such images are fractal in appearance, and can thus be approximated very well using a recursive function.

For these reasons, we tend to see procedural textures used far more often in scenarios requiring a fractal-like image, which is why the two are linked and sometimes confused. However, their two definitions don't overlap at all.

Many games employ procedural texturing. Commonly, one will procedurally generate textures for their cloud-scape, terrain height-maps, fog and other organic patterns. The reason they are considered superior to traditional textures is that the function describing the texture may only be a few bytes in size, whereas the texture itself may be several megabytes. Furthermore, the algorithm will often allow the texture to be generated at any scale required. In this way, we can trade storage and memory-consumption off against processing/loading time.


Share this post

Link to post
Share on other sites
Probably the best source of info on procedural textures is this book:


You should also download Terragen:


and play with it for a couple of minutes. That should give you the idea what procedural content really is.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!