Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Filip

Sky-rendering techniques

This topic is 5408 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

Hello, I would be glad to know how to do some good (both performance and quality) skies. They have to be real-time. The sky in Blizzard''s World of Warcraft looks great, but how the hell have they done it????!!!!! Thanks, Filip

Share this post


Link to post
Share on other sites
Advertisement
Just use a skybox (an unlit cube, centered on the camera, textured on the inside). Anything else tends to get complicated. (multiple pass volume rendering of clouds with ray-traced silver linings anyone? Didn''t think so). If you want it to look good then use a very high texture resolution.

-


Geocyte Has Committed Suicide.

Share this post


Link to post
Share on other sites
Forget the box. Its good for static backgrounds, especially in fps, but bad for RPG dynamic backgrounds. I was just working on atmosphere. Here is what I found:

1) Use a sky plane ( see tutorial www.spheregames.com ).
a) interpolate vertex color from east to west using a gradient map based on time of day. This lets you simulate sunrise and sunset, dusk, dawn, etc.
b) at night fade in a star field on the sky plane ( over the course of 1 virtual hour after dusk / before dawn ). Use a star texture with very small (1-3 pixel) monochrome but dense stars that can be easily tiled. Do not use nasa, epecially hubble images. They are good for outerpace but not planetary shots.

2) Billboard the sun and moon. You can easily use some trig to get a quad that you can rotate across the sky. Use a nasa image for the moon texture (clean up and add alpha in photoshop). Draw the sun texture yourself, since you have to fake it because computers lack the true dynamic color range to do a real sun. It is a point with exponential fall off and a lens flare on top (tint it orange if you like).

3) Interpolate the sunlight color and position across the sky. It should be white at noon, and get red near dusk / dawn. At night use a low level blue light.

4) Use fogging to simulate atmospheric / aerial perspective (use the average color of the sky based on time of day and where the player is looking for fog color). You can see extensive use of this in the WoW screenshots.

5) Use procedural clouds. This is used in War3 and I suspect a variation is being used in WoW to simulate that atmospheric haze / turbulence ( it looks more like haze than cloud, but this algoritm can be used to either effect by varying sample size, texture coordinates and blending). Hard to tell since I have not seen WoW in motion. Best procedural cloud article is by Kim Pallister on Intel (better than his game programming gems article). goto developer.intel.com and search for Kim Pallister Clouds (its the only article that comes up).

Share this post


Link to post
Share on other sites
The problem with most tutorials about rendering skies is that they''re targeted at the beginner programmers. Once you actually get your skybox/skyplane/skydome/whatever to work, it''s VERY VERY VERY hard to make your skies actually look good. Obviously a static texture can have a good effect, but if you''re interested in procedural effects that change overtime it''s VERY hard to get it just right.

I''m working on rendering a sky right now. I''ve tried every possible render state/texture/procedural technique and my skies still look like crap. If anyone can give suggestions on how to actually make skies look good, it''d be very helpful.

Share this post


Link to post
Share on other sites
I agree, good realtime skies a *very* hard to make. I finally got something more or less OK, though it still isn't as photorealistic I would like it to be. But it's the maximum I could get, and I spent over 6 months on the sky system, so it has to be enough...

The problem is that it's very hard to find a parametric sky model, that is fast to compute, but still good looking. After searhcing through dozens of research papers, without any luck, I did something rather simple: I took TerraGen. Turned off anything but the sky. I analyzed the working of every sky-related parameter: how were the gradients computed, how were the cloud layers done, shaded, etc. I tried to simulate all those features (in simplified form) in realtime. A skydome with exponential tesselation does the gradient. The sun is a projected texturemap, added onto the dome. The clouds are a realtime fractal cloudbox (using 8 octaves of perlin noise, with an exponential cutoff), shading is done using a voxel technique. The volumetric lightrays are nothing but a blended trapezoid, using a 1D texture which is modulated by the alphachannel of the cloudbox.

The sky runs at approx. 120fps on a GF3 Ti200. It does not use any vertexshaders, but a few regcoms are used.

This is what it currently looks like:



/ Yann

[edited by - Yann L on June 7, 2002 8:08:39 PM]

Share this post


Link to post
Share on other sites
Wow man that is pretty well, erm.. pretty

Do you have a small demo showing it moving? Do the clouds billow and change over time or just move around?

Share this post


Link to post
Share on other sites
quote:

Wow man that is pretty well, erm.. pretty


Thanks

quote:

Do you have a small demo showing it moving? Do the clouds billow and change over time or just move around?


Well, it''s part of a commercial game engine, but I think if I put together a little demo, no one will kill me I''ll do that, as soon as I find some time.

About the clouds: normally, they just move around. That way, new fractal data needs to be generated at the edges of the cloud field only, that makes 1536 samples per frame. However, the system allows you to make them billowing, and changing shape. The problem is that you''d need to recompute the fractal coefficients for the entire sky each frame, that''s more than 1.7 million samples per frame... So, it''s a tradeoff with the complexity of geometry under the sky: if less CPU power is taken by the general scene, then the sky can be made more interactive.

I had the idea of computing two fractal sets, and interpolating over time, this could be nice. I''ll have to try that out someday.

/ Yann

Share this post


Link to post
Share on other sites
I have to say, these are some amazing looking clouds. I don''t know why you aren''t totally happy with them, but they seem photorealistic to me.

Can you give a little bit more information on how this is done? I have a couple of questions, if you could give simple answers that''d be great.

1. Can you specify how you blended the layers? I can''t find a good blending mode for my color gradient and the clouds.
2. How did you use the exponential cut off function for the clouds? I can''t get it to look right.
3. I see that you have thinner clouds closer to the horizon and denser clouds closer to the viewer. Is that just this particular screenshot, or you purposely simulate that condition? How did you do that? Just use multiple layers with different parameters to the exponential function and then blend them all?
4. Some of the clouds are darker then others. Is that multiple layers again with each layer having a different color assigned to it? I see you have darker clouds near the sun. I''m not sure but if that''s the correct way of doing things.

Your clouds looks great if you''re aiming for a photorealistic model of the real world. If you try to simulate a warm magical world or a cold science fiction world these clouds aren''t very good in setting the mood. Obviously you can change the gradients and tweak the desnity parameters, but I can''t picture how it would look. If you take a look at some world of warcraft screenshots (http://www.blizzard.com/images/WoW/screens/october/ss024.jpg) they don''t look nearly as realistic as yours, but they set the mood very nicely. The screenshot above looks like they have two layers and a gradient. I tried to simulate that, but for some reason their clouds look soooooo much better I think my problem is blending the gradient with the cloud layers and using the exponential function to make the clouds less dense correctly. If you can answer some of my questions, that''d be great.

Thanks.

Share this post


Link to post
Share on other sites
quote:

1. Can you specify how you blended the layers? I can''t find a good blending mode for my color gradient and the clouds.


Standard alpha blending ( final = cloud_alpha * cloud_clour + (1-cloud_alpha) * gradient_colour ). It''s not so much a question of the blending mode, but more a question of the colours used, they have to match visually.

quote:

2. How did you use the exponential cut off function for the clouds? I can''t get it to look right.


Directly from my code:

// f is the cloud density value from the fractal generator (range 0 to 255)
f = f - CloudObject->density;
if(f<0) f = 0;
f = pow(CloudObject->sharpness, f);
f = 255.0 - (f * 255.0);
// f now is your cloud opacity cloud_alpha

the density and sharpness members control the overall look of the clouds. density (default: 150) controls how clear or overcast your sky is. sharpness (default: 0.96) controls the sharpness or ''fluffyness'' of your clouds. You''ll have to play around with the parameters.

quote:

3. I see that you have thinner clouds closer to the horizon and denser clouds closer to the viewer. Is that just this particular screenshot, or you purposely simulate that condition? How did you do that?


Hmm, I don''t really get what you mean here. The overall cloud distribution density is constant over the entire virtual cloud plane. The fact that the clouds seem thinner towards the horizon is just the effect of the perspective, objects tend to look smaller when far away...

quote:

Just use multiple layers with different parameters to the exponential function and then blend them all?


No, there is just one single cloud layer. Imagine a huge (infinite) plane floating over your world. This plane is procedurally textured using a fractal cloud function. Since it extends out to the horizon, the clouds will get affected by perspective just as any other 3D object. This is just as it happens in reality, with the slight difference that the real ''cloud plane'' is curved and not planar.

quote:

4. Some of the clouds are darker then others. Is that multiple layers again with each layer having a different color assigned to it? I see you have darker clouds near the sun. I''m not sure but if that''s the correct way of doing things.


It''s the effect of multiple light scattering and self shadowing. Again, lighting is done using the same unique cloud layer than used for cloud_alpha (see above). The lighting computations take into account the amount of light scattered through virtual cloud voxels (virtual, since the cloud layer is essentially 2D, so voxels are extrapolated) and scattered through the atmosphere. Basically, for each cloud texel, the amount of light reaching it from various directions is computed, as well as the light reaching the eye (which is assumed fixed in the middle of the dome). This requires evaluating a complex integral, but it can be hardware accelerated, as described in this paper.

quote:

Your clouds looks great if you''re aiming for a photorealistic model of the real world. If you try to simulate a warm magical world or a cold science fiction world these clouds aren''t very good in setting the mood. Obviously you can change the gradients and tweak the desnity parameters, but I can''t picture how it would look


Well, yes, the model was done with photorealism in mind. But by tweaking various parameters, you can get almost every weird effect you want.

quote:

If you take a look at some world of warcraft screenshots they don''t look nearly as realistic as yours, but they set the mood very nicely


Hmm, they seem to use a totally different technique. The clouds are very blurry, if you like that effect, you can just use a lower resolution cloud texture. But there is somthing a bit strange, it seems as if there was no perspective on the clouds ? Might be that particular screenshot though (I never played that game).

Hope it helped,

/ Yann

Share this post


Link to post
Share on other sites
Wow, that''s some amazing work Great!
I gotta get my engine running so that I can try this kind of programming myself ...

Some cool ideas for you all:
Thunder and Lightning? Haven''t seen any good yet, would be interesting (and coupled with awesome sound effects, yay!).
Aurora? Haven''t seen that either
Also, when watching the sun, you hardly see anything else. Have only seen that a very few times, too few.

Share this post


Link to post
Share on other sites

This topic is 5408 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.

Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!