Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Atmospherics
Post New Topic  Post Reply 
Drawing inspiration from this sky thread, it might be interesting to further develop those ideas with more refinement and variety.

Regarding clouds, they can be classified into several categories, notabale among them are: Cirrus, cumulus, cumulonimbus, and lenticular.

Cirrus are high altitude clouds, likely best rendered as a skyplane, and are high frequency repeating splotches, often parallel, and generally broken up into approximatly equal sized pieces.

Cumulus are fair weather clouds, puffy and stereotypical of a person's perception of what a cloud is. Gardner suggested rendering such clouds with elipsoids textured with a noise function with an alpha transparency becoming greated towards the ellipsoid's sillhouette.

Cumulonimbus are the high billowing clouds, often vertically billowing, and are harningers of bad weather.

Lenticulars often form over high mountain crests and peaks, are usually very horizontal and smooth in shape, and have often been said to look like flying saucers. In the High Sierra, the lenticulars have a name: the Sierra Wave. Here is a beautiful picture of a stunning Sierra Wave.

Here is further information on clouds, including pictures. And here is more information on clouds and their formation.

One thing which I am not sure has been correctly addressed with regard to illumination of clouds, or mountain peaks, for that matter, is the phenomenon of alpenglow. As we know, as the sun gets lower, its light passes through more atmosphere, scattering the blue wavelengths, causing the light to become orange and then pink. What this means with regard to altitude is: the higher the sruface which is receiving the light, the more red it can be, because it can receive light through a greater portion of the atmosphere. Long after the sun has set (or long before the sun has risen) for someone standing on a low plain, sunlight can still illuminate mountain peaks and high altitude clouds, and with a more red light than can be received by the viewer standing on the low altitude plain. But the viewer can see the light on the high altitude surfaces. Two things are obvious here: predawn light, and post dusk light should cast a very pinkish glow on high altitude clouds and peaks.

With regard to the altitude of the viewer, the higher the viewer goes, the darker blue the sky becomes. The extreme of this is entering space. But the effect is very noticable at modest altitudes, such as above 10,000 feet. The sky is a notable deeper blue. Another effect of being at altitude is (what I believe) a smaller halo around the noontime sun, because of less density in the atmosphere.

There are cases, where the Sun's (and Moon's) disk become very hardedged, with essentially no halo. These times are when the proper layer of haze or cloud density is in front of the disk. During midday, this might be due to a certain density of cloud cover, and result in a pure white, yet hardedged disk defining the sun. During sunset, when the sun might be yellow or orange, the disk again is sometimes very hardedged, with no halo, this time often due to haze.

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I would also be interested in a followup sky thread. I have significantly extended the sky model since that thread, but with more emphasis on the lighting and atmospherics part (newer 3D cards allow much better volumetric approximations of the actual light scattering integral). I have not really touched the cloud generation, but if I'm not mistaken, Greeneggs was working on a convection cell model, which could be used to simulate different meteorological conditions. Would be interesting to know about the results he got.


 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I was thinking about clouds and textured skyplanes and projecting these textures to cubes to get more bang for your buck with regard to resolution, as described in the above referenced thread, and it ocurred to me that you could do it like this instead:

Compute several separate skyplane textures, each a fraction of the size of one larger one. Forget about connecting these separate textured planes together, as there is no point or reason. Render each of them at different altitudes. The ones near the viewer would have a higher resolution. The ones further from the viewer would have a lower resolution.

As these cloud planes move (due to wind forces), they can be upgraded to higher resolutions, or downgraded to lower resolutions, based on their distance.

So, instead of having one giant texture at 2048x2048, one could have two large textures at 512 x 512, several at 256 x 256, quite a few at 128 x 128, and so on. With alpha blending, each can be rendered at a slightly different altitude. If they overlap a little, it doesn't matter. If they don't overlap and are separated by gaps, it doesn't really matter. Each plane represents its own group of clouds. The appearance would basically be the same as one large texture, but you get the advantage of creating resolution where you need it, illuminating layers based on altitude, a more 3 dimensional layering of clouds, and no necessity to projecting to a cube.

[edited by - bishop_pass on January 24, 2003 10:12:06 PM]

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Taking the above methodology a step further, you could also incorporate into the above system a set of billboarded cumulus and cumulonimbus cloud planes, which would seem to be more conducive to a vertically aligned plane, rather than a horizontally aligned plane. The most important part would be to make sure these vertically aligned billboards don't intersect with the horizontally aligned cloud planes. Some of these billboards could be above some horizontal planes, and below others. Because of the flexibility in adjusting the heights of the horizontal cloud planes, there should be little difficulty in interleaving the vertically aligned cloud planes among them.

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

The layer idea is interesting, but you'll end up with the same problem you have in one-plane cloud rendering: getting enough resolution for the clouds near the viewer. For a good looking overhead, low altitude texture, you'd need at least 1024². You can make it smaller (on the xy-plane dimensions, thus increasing perceptual resolution), but you will probably see cracks at the edges then. Even though the layered concept will mostly hide distant overlaps and gaps, this illusion will not work near the camera. Unless you use pretty small distinct clouds, each one in it's own texture (and a fading out transparency near the texture edge, to hide artifacts).

Lighting will be another problem. Moving around the cloud layer pieces is easy. But at every motion step, you'll have to recompute the lighting, as it will gradually change. Computing convincing 3D-ish lighting on separate patches (over different altitudes) will require heavy processing on the CPU side. The new solution will have to be transfered to the 3D card every frame (-> AGP saturation). You might be able to get away computing the lighting solution every, say, 5 frames or so, and interpolate inbetween.

If I had to redesign the cloud generation system, I would still use a multi-layer approach. But only with two or three fixed infinite layers. Use some meteorological algorithm to compute the basic cloudscape (convection cells, or whatever else), and use DX9-level pixelshaders to add fractal detail on the GPU. That would save transfer bandwidth, memory and fillrate. But I agree on the point, that multiple layers will allow for a better 3D effect, and more realistic cloud movement due to differing wind speeds at different altitudes.

quote:

Taking the above methodology a step further, you could also incorporate into the above system a set of billboarded cumulus and cumulonimbus cloud planes, which would seem to be more conducive to a vertically aligned plane, rather than a horizontally aligned plane


Yes, that's a good idea. But here again, realistic lighting might become a serious problem to do in realtime.


 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Regarding layer edges, I was assuming that no actual cloud imagery would extend to the boundary, so that no edges would be visible.

I was pondering the idea of faking the cloud shading. As you described in the other thread, the sun is treated as a point lightsource, presumably positioned in such a way that its position is in direct line with its more true infinite vectored rays and the viewer, and raised to a height to best simulate the perspective shift when calculating the lighting.

Given that position, vectors are computed to each vertex of the cloud plane from the light's position, and used to compute a texture shift in a second pass, very much like emboss bumpmapping.

By doing this, it seems that the clouds would accumulate the brightest lighting in just the right places. Actually, some redirecting and manipulation of the vertex to light vectors might be necessary, but a convincing result might be achievable.

The point that you have to realize is, they only need to look like a realistic lighting of any particular set of clouds' geometry, and not exactly like the realistic lighting of the set of clouds' gemoetry you think you are rendering. In other words, the audience doesn't know the exact geometry of the clouds you are rendering, and in fact, nor do you to any exact set of standards. If the audience can look at the clouds' rendering, and reconstruct in their mind where those clouds are, it doesn't matter if that minds' eye reconstruction parallels what was actually intended by the algorithm. It is only necessary that it would appear to be reconstructable to some physical geometry.

[edited by - bishop_pass on January 25, 2003 6:43:19 AM]

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Per-vertex lighting is not enough for a volumetric effect, might it be clouds, smoke, fog, etc. Why ? Because it will reveal the underlying geometry. A volumetric phenomenon cannot be represented by geometry, it is inherently 3D. Rendering volumetrics through 2D layers is always a fake approximation. If you want to make it look good, and really 3D, then the most important point is the lighting.

Now, with your idea, you will simply light the idividual 2D layers. It will look very flat. You need at least per-pixel lighting, there is no way around that. Each cloud voxel must influence the lighting solution at it's position. Now, you could probably do that using DOT3 bumpmapping, or something similar.

It will still look fake: shadows are missing. And that's the second most important point in realistic volume rendering. If you have a real cloudscape, then almost 90% of the lighting effect comes from mutual shadowing. Even if a cloud side is directly exposed to the sun, then that doesn't mean it is lit. Clouds infront, above, or even below (at dusk/dawn) can shadow it to various degrees. Even parts of the same cloud will achieve that effect, different cloud thicknesses will give totally different (non-linear) results.

Also light scattering is very important: A cloud side that does not face the sun, doesn't need to be unlit. If a large, lit cloud is direct behind it, then a part of that light will scatter (reflect) onto the unlit cloud.

To get a convincing result, you'd need at least some form of volumetric shadow tracing. There are various possibilities to do that, some better approximations then others. For instance, have a look at this paper.

You are right that you don't always need to simulate the physically exact real thing to get a good result. The Perlin noise I used in the other sky thread is a good example: it looks reasonably realistic, but has absolutely no physical relation with real clouds. But lighting is different. The human brain is highly trained to use light and shadows as the main clue to identify 3D structures at large distances (the stereoscopic effect breaks down from a certain distance on). Even a physically untrained viewer will directly notice, if something is wrong with the lighting. He will probably not be able to identify the problem, he will simply state that 'something is wrong, and looks fake'. We often had experiences like this, with our beta-testing team and customers viewing new effects in our photorealistic renderers. And also keep in mind, that clouds are an every-day phenomenon for everybody. People are highly used to the 'real look' of real clouds.

/ Yann

[edited by - Yann L on January 25, 2003 10:43:20 AM]

 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Can you provide some links on the light scattering and on the integral?
I'd like to know how the actual scattering works and how it is evaluated.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Light scattering is an important part in optics, so an advanced physics book should basically cover it. But that's mostly dry theory. For more practical exmaples, applied to computer graphics (esp. volume rendering and sky/atmosphere), you should take a look at those papers:

Same as in my reply above. Pretty simple and easy to understand.

Tomoyuki Nishita's publication list. 5 pages of highly interesting papers. Many of them treat realistic lighting. Nishita (along with Dobashi) is one of the Gods of realistic natural effect rendering. Download as much papers as you can, they are truely worth it


Vetrrain's atmosphere page, and their cloud rendering section.

The good old Preetham, Shirley & Smits paper, A Practical Analytic Model for Daylight.

The best resource is definitely Nishita and Dobashi papers, see above. They have a least 20 papers about particle scattering, special effects and lighting. I have some more very interesting papers here, but you need an ACM account to access them online.

/ Yann

[edited by - Yann L on January 25, 2003 11:04:45 AM]

 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Yann, I didn't suggest per vertex lighting. What I suggested was per pixel lighting using shifted vertex coordinates in a blended subtractive pass, akin to emboss bumpmapping, but using a different equation to shift the texture corrdinates in the second pass. Whether this would produce convincing results or not remains to be seen, but as you say, self shadowing, self illumination, and neigbor illumination are necessary too. No doubt you have more hands on experience with coding cloud light scattering than I, as I've only thought about.

Regarding cirrus clouds, they do in fact have a rather simple lighting model, because they are generally the top layer of clouds, and all resied in the same plane. To best produce them with noise, I would scale one texture dimension (let's say t) to be possibly two to four times the other texture dimension, and rotate the texture so that the texture aligns with the predominant wind direction at that altitude. I would then work on modulation of the octaves until you achieve what is a typical scale for these multiple parallel broken up clouds, which all appear to be about the same size. For their illumination, I've noticed that they scatter the light well, and usually appear mostly white with feathery edges. But after sunset, they are still receiving orange light from the sun, because of their altitude. And well after sunset, they receive a light that has been scattered moreso than any landbased viewer could ever recieve, meaning more blue light is scattered than the landscape could ever receive. The result is a pink glow that is not achievable at lower altitudes.

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:

Yann, I didn't suggest per vertex lighting. What I suggested was per pixel lighting using shifted vertex coordinates in a blended subtractive pass, akin to emboss bumpmapping, but using a different equation to shift the texture corrdinates in the second pass


Hmm, I see. I'm not entirely sure about the results of that, but you would probably get similar artifacts as you have in emboss bumpmapping. That isn't necessarilly too bad, though, since cloud shading doesn't really need to be extremely precise - the overall lighting is what matters. However, I would still suggest the use of DOT3 for this: it will probably give you similar results, and is a lot faster than a dualpass (or dual-unit pass) on modern hardware.

quote:

Regarding cirrus clouds, they do in fact have a rather simple lighting model, because they are generally the top layer of clouds, and all resied in the same plane.


Yes, that is true. In my own experiments, I've come to the conclusion that you can pretty much ignore perpixel lighting on high altitude clouds. Also self shadowing can be reduced to a minimum, although cirrus clouds should still cast shadows on lower altitude layers (and onto the terrain below).

I think adding a high altitude layer to a general single-layer system will probably be beneficial for the quality. Lighting should not be too problematic. The biggest plus is that it allows to take different wind speeds or even directions at different altitudes into account, a drawback of the original model, as you mentioned above. It would require a second fractal noise generation pass on the GPU (better do it directly on the GPU, you can't afford to lose precious AGP bandwidth for the sky, the main 3D geometry will already take tons of it). But on modern hardware, that shouldn't be too much of a problem.

There's another consideration, that was on my mind for quite some time now. Should fractal cloud generation not better be replaced by some realistic cloud convection model ? The big plus of fractals is that they can be computed on the GPU. That's very fast and extremely efficient. Other models would need to be done on the CPU. But what bothers me, is the limited control you have. You can't easily connect real-world weather situations to a fractal system. I was thinking about a dual approach: compute the low octaves by using a meteorological model. Stream it to the GPU, but only at a lower resolution. This will give the overall shape of the cloudscape. Then, add fractal details on the GPU, by adding the remaining higher octaves.

Also, I was thinking of adding some additional lighting effects to my sky. I always wanted to implement a nice storm, with lightning and all. I started implementing Nishita's lightning algorithm, but I put it on hold due to lack of time. Another interesting thing is to add aurora. This phenomenon just looks awesome, I want it in my sky model Anyone knows about some paper on aurora simulation ?

You mentioned Alpenglow in your original post. Interesting thought. I guess, it would especially be important in mountain scenes. I wonder how much that would complexify the light scattering model. You'd need to take local terrain geometry into account, when computing the cloud shading. Hmm. If your terrain is a heightfield, that should not be impossible. Need to think about that. It's true that dusk/dawn scenes are pretty difficult to simulate, especially if the sun is under the horizon.

/ Yann

[edited by - Yann L on January 25, 2003 4:10:08 PM]

 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Yann L
You mentioned Alpenglow in your original post. Interesting thought. I guess, it would especially be important in mountain scenes.

Yeah, but what I've been saying also is that alpenglow is important whether you have mountains or not, because alpenglow is nothing more than light which affects high altitude objects at dawn and dusk. And an example of high altitude objects are clouds.

Most importantly, what I've been saying about alpenglow is how pronounced the red and pink tints can become for the high altitude objects, because they receive light from a longer path traveling through the atmosphere.

This is why the color of the light shining on the viewer and his immediate environment is not the color of light shining on other objects - notably high altitude objects.

Also, the high cirrus clouds will receive light (and it will be very pink) as much as forty-five minutes to an hour or so after the sun has set for the viewer. And, as I said, that light becomes increasingly pinker.

In this image, from my photo gallery, we can see the pinkish illumination on the high cirrus clouds long after sunset:




Here's an example from my gallery of a high altitude layer receiving light long before sunrise:





Here's an example from my gallery of a lenticular over the Eastern Sierra: (also, in the same picture, notice the high cirrus clouds, and their parallel high frequency shape. This is why I suggested that cirrus clouds get one texture dimension scaled).




If you look more through my gallery, you'll see more examples of various cloud lighting and shapes.

[edited by - bishop_pass on January 25, 2003 4:58:50 PM]

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

In my own expirements with cloud generation, I found that with some clever tricks perlin noise is fairly easy to control. I stole the idea from "Texturing and Modeling: A Procedural Approach".

In my cloud system there were more then 20 constants that I picked manually by playing around with the values. Some values ranged from 0.0 to 1.0, others had much more obscure ranges. Generally, even the values that ranged from 0.0 to 1.0 were hard to pick because increasing the value didn't necessarily increase the effect. Also, changing one value sometimes affected others. Needless to say that hand picking the values was extremely hard. The approach I picked up from the book above is the following: create some sort of genetic algorithms system that merges two sets of values. Pick the values randomly from predefined ranges and render a set of screenshots. Pick the shots you find pleasing, and cross their values (introducing some noise). Repeat the process until you get a nice value set .

I found that with a good merging algorithm around 10-15 generations with about 10 shots per generation is enough to produce very good results. You can run the simulation numerous times and steer it to the weather conditions/cloud types that you like/need.

Once I produced my basic sets of values for various environments I simply interpolated between them at runtime to produce environmental changes. Unfortunately I never actually developed an automated tool, so getting these results were a lot of work, but if you develop a tool that lets you go through this process easily you can get amazing results fairly easily and quickly.

 User Rating: 1031   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

kill: sounds pretty interesting, the idea with the genetic evolution. I have to try that someday.

The problem with the control is, that I'd like a more real system, where cloud generation is coupled with other atmospherical data: moisture, temperature, wind direction and speed, mist/fog factors, time of day, etc. My weather control system slowly modifies those values, a little at random, but still in accordance with parameters given by the map the player is currently in (climatical factors, if you want).

Also, lots of our game is based on magic spells, and some of them show tremendeous effects on atmoshperical conditions. I wanted to include that into the system. Eg. you cast a storm spell. Then suddendly, thick billowing clouds will roll in, the wind will get stronger and stronger. Light will fade away, as a thick, dark cloudfront appears. Lightning flashes through the clouds. The rain particle system starts up. Etc. All this is controlled by altering the meteorological variables above. I have currently linked them to the Perlin noise generator, and it works more or less OK. But there are some conditions, I just cannot simulate. For example the rolling-in storm fronts.

bishop_pass: Oh, OK, I had a somewhat different definition of alpenglow in mind. Well, in that case it should be pretty easy to get with the current lighting model. All you'd need to do, is place the sun-pointlight under the cloud layer, ie. reverse the heightfield gridtracing computations. That should do the trick. Choosing the colours is another matter entirely. We'd need some analytic model of Rayleigh scattering for very low sun here.

/ Yann

 User Rating: 1996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

The color of sunlight is (for the most part, in a simplified model) a function of the distance it travels through the atmosphere, as you know, and the size of the particles it intercepts along the way. Actually, I'm sure you've already worked on those equations. To start, you intersect a ray through a sphere which represents the atmosphere.

Anyway, blue light is scattered first, and red last. The further the sunlight passes through the atmosphere, the shorter wavelenghts (blue) are lost. That's why the last rays of the day are red.

A very simple model (using RGB components) could just base it on distance traveled through the atmosphere, and scale out the blue componenet first, leaving green and red, which is yellow, and then lastly, red alone. That's actually what you want - a transition from white to yellow to red.

The funny thing is, if you multiply this color by white (the color of the clouds), you get red, not pink. In other words, the above hack does a good job of calculating the color of the sun, but the actual light received by the objects should have some of the other color components added back in. In other words, red, should have some green and yellow added back in, to get pink, before multiplied by the cloud color. The same goes for when the clouds are receiving yellow and orange light. This may in fact have something to do with the fact that you are viewing the clouds through the still blue light of the sky.

This all may sound very hackish, and maybe the full Rayleigh scattering equation captures all of this not only accurately, but actually produces a result that you want, which some physically based equations don't due to them always being an approximation anyway.

[edited by - bishop_pass on January 26, 2003 1:25:51 PM]

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

For weather dynamics, some factors that you should take into account are aridity and wind direction. Aridity plays a major role for moisture in the sky, and thus clouds. And aridity has a lot to do with the concept of rain shadows, which I mentioned in the "Snow revisited" thread.

[edited by - bishop_pass on January 26, 2003 1:23:34 PM]

 User Rating: 952   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link


As far as I know the atmospheric model is very important in rendering large bodies of land and water. As bishop already mentioned different wavelengths scatter differently depending on the atmosphere. Another important issue is that the visuals start to lose contrast when they get sufficiently far away from the viewer. Because these changes start to affect the scene relatively far from the viewer a good vertex program should be sufficient to approximate these phenomena. I'm not sure how to simulate loss of contrast in a vertex program, though (any ideas?). In my early experiments I used simple fog, but was unable to get anything semi-realistic. The loss of contrast seems to be very important to realistic perception of the scene. Can someone explain this phenomena in more detail?

 User Rating: 1031   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

well i dont know much about why it happens, and i dont really know what goes into making a vertex program or pizel shader or anything so i dont really know what you can and cant do...

but i assume you could test each pixels (or vertexes, pixels would most likely be way to slow) and then run that through your light-scattering function to calculate how much of the light was scattered in its trip through the atmosphere to your eye. this would probably be pretty slow (but im not sure, i really dont know how much todays graphics cards and cpus can handle)



Sam Johnston (Samith)

 User Rating: 1381   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

For a (ground based) game, do you think it would be possible to raytrace the sky? The sky would only be changing very slowly (unless it is windy I suppose), and the player would rarely be looking at the sky I would presume. Thus, you could possibly raytrace the sky, doing it at a very slow rate (say a couple of texels per frame) and so on. It would mean that it would be possible to get awesome sunsets.

An extension of this idea (and possibly other ideas) would be to make clouds act as lights, so on an overcast day, there will be very soft shadows while on a cloudless day, there would be sharp shadows. With the raytraced version, there could be a ground plane which isn't rendered, but any rays which hit it have their position, colour and intensity recorded.

Trying is the first step towards failure.

 User Rating: 1023   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

hm.. on the ati page, there is a realtime running demo for atmospherics, Rendering Outdoor Light Scattering in Real Time.

it runs on ps1.4+ cards, and looks amazing imho.

and the paper could be a good start to read, too..


only if it wasn't mentoyed yet before, of course:D

"take a look around" - limp bizkit
www.google.com

 User Rating: 1357   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Thanks for the links Yann! and I just got an ACM account. Now I have access to all the papers including old ones. I don't have to go to the library now

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: