Sign in to follow this  
fpsgamer

How to create "Crysis clouds"...

Recommended Posts

The clouds themselves are doable with regular old particles (that don't move). I've managed to do just fine using 3 channels (XYZ) of Perlin noise range-bounded by a simple bounding box to compute the positions I use -- just that using something like linear interpolation is ugly; sinus interpolation works well enough. For more complex shapes of clouds, you just use multiple boxes to form a single cloud.

The main thing isn't really the cloud itself so much as how you light it. From what I've seen of Warhawk's clouds, I kind of surmise that what they do is a simple raycast to a lightsource testing for particle intersection within the cloud (treating each particle as a sphere) and attenutating the light based on how many intersections were found.

Share this post


Link to post
Share on other sites
Quote:
Original post by cpiasminc
For more complex shapes of clouds, you just use multiple boxes to form a single cloud.

This is exactly what they do in Flight Simulator 2004 (Realistic and Fast Cloud Rendering), and from the presentation e-u-l-o-g-y posted they seem to use the same method for shading (as in FS2004). So nothing really tricky here. It is more of an artistic work.

Btw, this tracing of spheres and attenuating light would be interesting to investigate further. Maybe on GPU?
IIRC from their videos, smoke seems to be illuminated correctly (i don't know how exact is their method), so i suppose they must use something similar for it. Maybe not for the clouds, but for the smoke. Any ideas on that?

HellRaiZer

PS. Nothing of the above is 100% sure.

Share this post


Link to post
Share on other sites
I recently implemented some clouds in my engine, mostly prompted by this thread..I think they turned out quite nice.. they are based on rendering batched sprites with some lighitng shaders.. they are real 3d clouds in a the world space.. not faked or on the skydome.. they float some way above the level, like real clouds.


Share this post


Link to post
Share on other sites
Quote:

I recently implemented some clouds in my engine, mostly prompted by this thread..I think they turned out quite nice.. they are based on rendering batched sprites with some lighitng shaders.. they are real 3d clouds in a the world space.. not faked or on the skydome.. they float some way above the level, like real clouds.

The screenshots are pretty. May i ask what you are doing for lighting? Are you using the same procedure described in Wang's paper (FS2004)?

HellRaiZer

Share this post


Link to post
Share on other sites
I didnt read Wangs paper actually..

basically i have two lighting tersm, one takes the base height of the cloud and darkens the sprite vertices by how far from the base they are--lower means darker--this gives nice shaded cloud bottoms.. then I calculate a spherical normal and do a lighting calculation from the sun, and then add it to the whole.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Wow, your clouds are really impressive - and quite easy to generate if I understand correctly:

a base position is given as a set of coordinates with a "randomized" y-value (for height)

further points are generated from this base point with randomized deviation from the base point (or the previous point...) and, again, randomized y values

these points are used as the position of the billboards (you could further specify varying sizes of billboards etc)

as far as the shading goes:

each billboard is darkened by how low the current y value is
I guess I am unclear of the term spherical normal. Could you explain this idea further for me?

Thanks!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Actually, I'm thinking about it and I believe that the "spherical normal" for a vert in the billboarded quad would simply be given by (in world space) normalize( vertexPosition - billboardCenter )

is that correct?

Also, what does the texture you used for the billboards look like?

Thanks, again!

Share this post


Link to post
Share on other sites
If different cloud particles potentially use different textures, are you binding/rebinding different textures for each cloud particle? Using an atlas? How do you keep performance good while switching textures for so many particles? Also, is the lighting shader for each particle aware of only itself locally, or does it take into account the effects of other particles besides itself?

Share this post


Link to post
Share on other sites
I'm curious about the "spherical normal" with respect to the lighting. If the viewer was to circle around the cloud(s) then due to the normal being the vector from the billboard center to the vertices and with the vertices being oriented to the camera, would they not move and cause the normal to change relative to the stationary Sun causing the lighting on them to "rotate" of sorts? For a FPS player's perspective this wouldn't be an issue, but for a fly through it might be evident... Thoughts?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

That would be intentional behavior in this case

The nature of billboarding necessitates rotating sprites that in and of themselves may cause a break in the suspension of disbelief when the rotation becomes apparent to the user (based upon certain camera positions/movement)

However I would contest that not changing the lighting would be even more apparent:

a) we need somewhat realistic looking lighting effects
b) the billboards will be rotating so we cannot rely on static lighting
c) the sun/light source could be anywhere so we probably do not wish to rely upon prebaked conditions

I have not implemented this procedure yet (though I intend to after work today) so I cannot say with certainty that I will be pleased with the lighting when looking at the clouds from a "cloud perpendicular to (lightPosition - vertexPosition)"

If I am not perhaps a simple and effective solution would be to interpolate between this lighting method and another (lerping between the calculations with (0,1,0) dot sphericalNormal)

another note:

Currently with this method we essentially conclude that initially the sun is directly up from the ground and those cloud billboards that are closer to the ground are darker due to obstruction of the higher billboards.

I'm thinking that it would be probably be better to calculate this obstruction value at runtime (because the sun will not always be directly above the clouds). So we end up with clouds that are darker the further they are from the sun along the normal of (sun-center). We may want to give the y-plane a different "scale" then the x-z plane (if y corresponds to height)

We would need to ensure that everything remains relative to the center position of the cloud "blob" and tweak the deviations etc until we find something palatable.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this