Posts tagged ‘OpenGL’

Real-time thermal erosion much faster now!

Intoduction

“A picture is worth a thousand words” so I suppose a video should be much better ;-)

The real-time erosion has gained a lot from the latest optimization work, the number of FPS is passed from 1.8 to 71.4 for my first thermal erosion and from 3.1 to 71.4 for my second thermal erosion, that means that the first erosion is about 40 times faster and the second one is about 23 times faster, a huge improvement for a real-time program!

Even if the second algorithm is faster than the first one, using a small heightmap (256×256) gives the same execution time for both.

First thermal erosion

This video shows a terrain generated by the sum of 6 octaves of Perlin Noise and eroded by 100 iterations (double the number of the previous video) of my first thermal erosion algorithm.

The video is available on:

this erosion algorithm allows an average frame rate (computation + visualization) of 71.4 FPS using a 256×256 16-bits floating-point texture as heightmap.

Second thermal erosion

This video shows the same terrain generated by the sum of 6 octaves of Perlin Noise and eroded by 100 (double the number of the previous video) iterations of my second thermal erosion algorithm.

The video is available on:

this erosion algorithm allows an average frame rate (computation + visualization) of 71.4 FPS using a 256×256 16-bits floating-point texture as heightmap.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Real-time thermal erosion

Introduction

I’ve improved the terrain engine adding my thermal erosion shaders, now it’s possible to see a real-time erosion (from computer graphic point of view, a real erosion would take thousands years :-P) just pressing a key!

The erosion is managed in a different way respect the previous applications I’ve made, now after every iteration, the result is shown by the terrain engine, so it’s possible to see how the ground changes during the whole process.

I’ve made a couple of videos to show this new feature, enjoy.

First thermal erosion

This video shows a terrain generated by the sum of 6 octaves of Perlin Noise and eroded by 50 iterations of my first thermal erosion algorithm.

The video is available on:

this erosion algorithm allows an average frame rate (computation + visualization) of 1.8 FPS using a 256×256 16-bits floating-point texture as heightmap.

Second thermal erosion

This video shows the same terrain generated by the sum of 6 octaves of Perlin Noise and eroded by 50 iterations of my second thermal erosion algorithm.

The video is available on:

this erosion algorithm allows an average frame rate (computation + visualization) of 3.1 FPS using a 256×256 16-bits floating-point texture as heightmap.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

A (simple) terrain engine - day 5

Introduction

The new version of the engine comes with a couple of interesting new features… texturing above all!

I see the colors!

As I’ve already introduced, the main feature in this new version of the engine is the use of textures for coloring the terrain

The previous images shows a terrain with no color texture (top left panel) and the same terrain rendered in the 3 different polygonal modes with texture.

Now, if no texture file is passed to the CLI, the program uses the heightmap as texture.

A change related to the use of color textures is the new color of the fog:

now it’s gray, giving a more realistic look.

The last new feature is a minimap drawn on the top left corner of the window, it’s useful to show the heightmap image and compare it with the 3D rendering:

I’ve also fixed a bug in the terrain rendering, now the terrain is drawn according to the right orientation (as showed by the image above).

Source code

The source code of this version is available here: 3D_terrain-0.5.1.tar.gz

UPDATED on 2008/06/19 replaced the file with a new version that fixes some bugs and adds frame rate control.

In order to compile the code you need: SDL, SDL_image and scons.

To know options and commands run:

3D_terrain -h
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

A (simple) terrain engine - day 4

Introduction

This day I’ve introduced another new feature to the engine: fog!

Misty days

OpenGL offers 3 different models for fog, the new version of my terrain engine allows to test them all just pressing a key:

The top left panel shows the terrain with no fog, the top right panel shows GL_LINEAR fog, the bottom left shows GL_EXP fog and the bottom right panel shows GL_EXP2 fog.

Of course the last one is the more realistic, but fog generated with GL_LINEAR is quite similar and it’s faster to compute.

Another news that it’s possible to notice from the previous image is that now the background color of the scene is blue, similar to the default background of Blender, this is not just a “tribute” to the 3D program, but it’s a way to have a better contrast between the terrain and the background.

Instead the color of the fog is totally a tribute to the fog used in “Warhammer 40k, Dawn of War“, a game I’m playing with in this period :-)

Source code

The source code of this version is available here: 3D_terrain-0.4.0.tar.gz

In order to compile the code you need: SDL, SDL_image and scons.

To know options and commands run:

3D_terrain -h
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

A (simple) terrain engine - day 3

Introduction

Another improvement of the terrain engine, now it can render something more than simple points!

New features

Now the program is more an engine (even if really simple and not optimized) than a simple demo as in the previous version, the main news is the replacement of points with polygons (triangles, to be precise).

In this version is possible to render the terrain using points, not filled triangles (lines) and filled triangles, as showed in the following screenshots:

          

Using triangles instead of points allows also to notice better how the sampling level affect the rendering:

Source code

The source code of this version is available here: 3D_terrain-0.3.0.tar.gz

In order to compile the code you need: SDL, SDL_image and scons.

To know options and commands run:

3D_terrain -h
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]