Atmosphere & Terrain Rendering System

Anonymous Feb 12, 2008 at 15:00


This is a screenshot of our Mountain demo. The demo shows Awakening’s Atmosphere & Terrain Rendering System, can runs on Geforce & Radeon series, use three passes to render on Geforce 256 level accelerators.

This rendering system is a extension package of Awakening 2.5, mainly consist of two shader files and two script files. The two shader files respectively for sky and terrain rendering, and the script files provides two classes: Sun and Atmosphere to control various parameters. Sky only use vertex shader to produce color, no texture; Terrain use vertex shader to produce scattering effect, and decal map + normal map + horizon map with pixel shader 1.0 to do bump lighting & shadow. For those 3d-accelerators without pixel shader, use dot3 colorop to do bump lighting and disable bump shadow.

The idea of this rendering system originate from the article “Rendering Outdoor Light Scattering in Real Time” by Naty Hoffman (Westwood Studios) & Arcot Preetham (ATI Research) – thanks to Hoffman & Preetham’s great work!

For more information, please see here.

7 Replies

Please log in or register to post a reply.

roel 101 Feb 12, 2008 at 18:42

That looks good! But you say you compute the scattering only in the vs, right? Then you must use high tessellation to get it that smooth, don’t you?

aaqiang 101 Feb 13, 2008 at 02:42

You are right. But the model doesn’t need too high tessellation; in the Mountain demo, sky has 2420 faces and terrain has 32768 faces. In a Radeon 9600/64M + Celeron CPU 2.0G / 256M RAM system, the demo can get about 150 FPS (800x600x32, turn off Blur Effect).

roel 101 Feb 13, 2008 at 23:21

Nice, I didn’t expect that.

wolf 101 Feb 14, 2008 at 19:45

Many games are already a few steps farer. Hoffman’s approach was not really practically useful because the sun is too big. So you had to tweak this … there is an interesting ShaderX article -I think it is in ShaderX3 or ShaderX4- about Hoffman’s approach compared to Pretham’s approach. The example code actually implements both approaches also with the vertex shader … and the results look quite similar to what I see here.

aaqiang 101 Feb 15, 2008 at 04:56

Sure, the sun is too big somewhat. I’ve searched all ShaderX Books’s Contents, and not found the article. Could you please give a link or article title?

Kenneth_Gorking 101 Feb 17, 2008 at 11:54

There are some errors in that paper which results in the sun getting bigger.

Their calculation of ‘(1-g)\^2’ is ‘1-g*g’ which distorts the phase function.

They also left out some calculations, and modified others to speed things up. For instance, the pow(a\^(3/2)) mentioned in the paper gets calculated as sqrt(a\^4), which also makes the sun bigger.

The Rayleigh phase function (1+cos\^2(theta)), is missing a multiplication with 3/(16*3.141592), otherwise the results are bi-directional. At sunsets this means that the sun can be seen on the other side of the sky. The funny thing is that he actually mentions this in the paper :)

Reedbeta 167 Feb 17, 2008 at 16:38

@Kenneth Gorking

the pow(a\^(3/2)) mentioned in the paper gets calculated as sqrt(a\^4)

lol wtf? sqrt(a\^4) = a\^2, and a\^(3/2) = sqrt(a\^3)…