Flying through a cloud

Started by
9 comments, last by Slaru 18 years, 4 months ago
I am making a cloud simulation and I have been having trouble picking from the many techniques. My choices boil down to: - Volumetric Clouds - Stored as a 3d 'volume' texture, then slices are made with polygons facing the camera that sections of the cloud are rendered to. Texture Splatting - Many random points in the cloud 'splatted' with small billboards (the splat being a cloud colour at the centre and fading out. Billboard Clouds - Like in MS Flight Simulator 2004. Lots of billboards with differing sprites on. Kind of like splatting, but rather than be put in one imposter (big cloud billboard) lots of imposters are made for sections of the cloud. I'm leaning towards the billboard clouds. I could even mix and match a bit. But my main problem is flying through the cloud. I understand that when I get to a certain point in the cloud, I need to lock the billboards somewhat, or else the billboards keep turning causing the 'parting of the sea effect'. That won't be a problem. But I still have the problem of 'popping' as I hit one billboard to the next. As well as the inaccuracy that you see when entering and exiting the cloud. I've considered simply rendering each individual random point in my volume as I approach it, I could even do it section by section, but it would still be slow. How do you recommend I avoid this popping? Does anyone know of any other techiques I could use (it's really hard to find info on modern volumetric rendering techiques...I'll take any, quick or slow)? Thanks,
Advertisement
Could you not fade the alpha value out as a cloud gets close to you. So, as your flying towards a cloud, once it gets to within say a meter, it starts to fade. That should avoid the popping and should actually add a nice gentle transition.

Of course, thats only a theory, never done it myself but I don't see why it can't be done.
Quote:Original post by ghosted
Could you not fade the alpha value out as a cloud gets close to you. So, as your flying towards a cloud, once it gets to within say a meter, it starts to fade. That should avoid the popping and should actually add a nice gentle transition.

Of course, thats only a theory, never done it myself but I don't see why it can't be done.

Skies Of Arcadia did this, and although its a simple trick it works really well. [grin]
Thanks for that. It's a really good idea...especially since I will be measuring the distance to all billboards anyway to lock them when I get close. I think I'll do that.

But out of curiosity, does anyone know of any more advanced cloud techniques? I'm doing this for a course at uni and I'm meant to come up with a couple of solutions and pick the best one. Sadly, I can't find anything 'better' than billboarding particles in one way or another.
In theory, the best technique would be to render a fullscreen quad, and for each pixel in that quad, reverse-project to get the ray that pixel represents, and then integrate the cloud function along that ray to get a total opacity value for the cloud along that ray.

However, if you find a way to integrate a 3D or 4D perlin noise function inside a pixel shader, then please let the rest of the graphics community know...

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Instead of locking the billboards as you get close, you could align them to your view vector instead of the camera to billboard center vector. I haven't tried this but it would be an easy thing to test.
You would need to use a point plane equation to get the disances to the bill boards, but it looks about the same cost as a distance calc here:
point to plane equation
Quote:Original post by superpig
In theory, the best technique would be to render a fullscreen quad, and for each pixel in that quad, reverse-project to get the ray that pixel represents, and then integrate the cloud function along that ray to get a total opacity value for the cloud along that ray.

However, if you find a way to integrate a 3D or 4D perlin noise function inside a pixel shader, then please let the rest of the graphics community know...


Yes, and if there will be way to do double integral (do integral to sun), that'd be really good.
Generally, the real high quality clouds rendering is based on raytracing, and clouds are defined procedurally using combination of Perlin noises [note: i'm currently using true perlin noise, but maybe will implement pseudo perlin noise based on summing few 3D textures later for speed]. I trace rays through clouds, from camera and from sun, computing the lighting integrals. There is aint no billboarding (and i don't think billboarding can ever look anywhere as good as real thing). Clouds raytracing would be REALLY slow (days/weeks per large high quality image with shaded clouds) if done completely unoptimized, so I'm using few acceleration tricks that I can't describe there because it's kind of secret.


As about simpler stuff -
You probably has already seen this, but just in case:
link
Another thing that is very important for realism is shading/lighting. You can for example precompute it by tracing rays from billboards through cloud and compute occlusion factor.

(i'm are doing clouds, by the way. Highly advanced non-realtime state of the art, maximal realism you can get, [insert other marketing blabla]. As far as i know, there is two other renderers in the world that is close, Terragen TGD (not released yet) and Storm (in-house software of Digital Domain). That's approximately like how clouds in computer games might look by 2010 or 2020, if progress will not freeze.
The most important part is shading&lighting)
Quote:Original post by Dmytry

Yes, and if there will be way to do double integral (do integral to sun), that'd be really good.
Generally, the real high quality clouds rendering is based on raytracing, and clouds are defined procedurally using combination of Perlin noises [note: i'm currently using true perlin noise, but maybe will implement pseudo perlin noise based on summing few 3D textures later for speed].


Well the GPU voxel drawing I've seen takes 2D samples, and then tri-linearly filters the information from the samples, then draws it onto polygons along the sample lines. Isn't the fake perlin noise effect just enlarging regular noise with such a filter? While this isn't ideal for the fancy clouds in years to come...perhaps it could make a decent (probably static only) cloud.

Just a thought.


Quote:Original post by Dmytry
As about simpler stuff -
You probably has already seen this, but just in case:
link
Another thing that is very important for realism is shading/lighting. You can for example precompute it by tracing rays from billboards through cloud and compute occlusion factor.


That's basically the technique I'm going for now. My class is real-time graphics so I doubt I have much choice. Static clouds and precomputed lighting all the way (once I get my head around turning multiple forward scattering maths into code).


Thank you all for the help,


How about using a blob shape polygon. Render the front facing triangles depth values to texture. Then do the same for the Back facing triangles. you can then compare the images to find out how much cloud you are looking through on a per pixel basis. You could then mix in a 2D perlin noise texture to blotchen it up a bit.
Since 'fog' and 'clouds' only differ in altitude, why not use a combination of the two?

1 - Increase the amount of fog in your scene, such that if a normally-easily-visible object pops into the scene quite without warning, making reflexes the only thing saving a good pilot from certain collision ;)

2 - In addition to the increased scene fog, have quickly-moving billboards flying past the view/camera.

The combination of the two should give the illusion of flying through a "thick as pea soup" cloudy area :)v This sort of trick is similar to what was done in Freelancer, when entering asteroid belts.

This topic is closed to new replies.

Advertisement