Some clouds

A picture is worth a thousand words.
snwy_
Posts: 25
Joined: Sun Jun 24, 2012 10:08 am

Some clouds

Postby snwy_ » Tue Jun 26, 2012 6:34 pm

Hey,

Been interested in trying to generate some clouds. The pic below is the state of that at the moment (may take a second for the pictures to start loading). Currently, only indirect sky light is considered.

Image

The clouds are the result of a couple of steps.

First, the CPU comes up with and maintains a simple Navier-Stokes fluid field (using Felix Woitzel's 2d code from here, converted to 3d and seeded by whichever forces you want to apply) while the GPU calculates condensation from about 4 million air parcels moving within the field. The condensation is placed into a moisture grid (below flattened into 2d) and given a median filtering, and finally triangles meshes are created around these moisture blobs.

Image

In the second step, the triangle meshes are fed into a path tracer which, upon intersecting one of them, starts traversing into the moisture grid at that location. Based on the amount of liquid water in that grid position, a chance for the ray to collide with a droplet is calculated. If the ray 'hits' a droplet, Mie scattering is estimated via rough chance (99 % of rays scatter forward, 50 % of those scatter forward in a narrow beam; as lucidly put in this thesis). A rough esimation of color shifts due to refraction is achieved by slightly adjusting the RGB values of each ray (can't afford spectral rendering). The benefit (or what I consider as such) of the moisture grid comes in here, as you can get some amount of soft edges without using fractals.

Some other 'cloud' shapes, though in these the way the condensation was accumulated was slightly buggy.

Image

Image

As I noted in the beginning, direct sunlight for clouds is not yet in effect. I'm looking into mapping some photons for that, but it's a bit buggy still. The resolution of the fluid grid needs punching up (currently 100 * 100 * 100). And there are various other things that need tweaking and changing.

Below is the first cloud mass fed from the cloud generator (first step) to the tracer.

Image

zsolnai
Posts: 24
Joined: Thu Mar 15, 2012 1:49 pm

Re: Some clouds

Postby zsolnai » Wed Jun 27, 2012 11:06 am

Great work, congratulations! To be entirely honest, I was thinking on doing the same thing in these days. :)
An idea: I have been working on real time fluid control methods these months, and I was also thinking on giving a little aid for artists who may be using it so they could give input on roughly how they would like the clouds to look, and some fluid control forces could be applied to make it look so. Like this:
http://cg.iit.bme.hu/~zsolnai/gfx/fluid ... ontrol.avi

It would also be good to adjust the weighting of the physical forces that you've modeled (and also in the thesis) and the control forces to be artist-friendly.

snwy_
Posts: 25
Joined: Sun Jun 24, 2012 10:08 am

Re: Some clouds

Postby snwy_ » Wed Jun 27, 2012 9:53 pm

Thanks, zsolnai. If you've been thinking about doing it, just do! The video's pretty cool – since you already have a fast fluid simulator running on the GPU, you can just put in some air parcels (or particles if you will), calculate condensation from them (this should be very fast on the GPU) as they fly around and you should have a relatively easy-to-use cloud generator. Mine is quite slow and not interactive in the least.

I did a quick implementation of photon mapping to get direct sunlight into the clouds. Below are some clouds illuminated by the sun + sky, and the photon map below them. (If you adjust the gamma upwards on the photon map image, you can actually see some stray photons heading out of the cloud - bugged.)

Image

Image

Basically what I do is trace a ray from the sun towards the cloud, and once the ray enters it, I add the light value of a single photon to a 3d grid at that location. I keep tracing the ray through the cloud, and to each new grid element it passes I add the value of a photon (which gets attenuated only by the slight color shifts due to refraction that the ray has experienced). In the end, the total number of photons is the total number of grid elements traversed by all the rays in the photon mapping phase. Then, during path tracing, while the ray is traversing the cloud, I add to it the light value from the photon grid.

I haven't really checked this method for any flaws in its logic, and it's a bit buggy, too, but the basic idea seems to work.

necro
Posts: 6
Joined: Thu Dec 22, 2011 9:44 am

Re: Some clouds

Postby necro » Fri Jun 29, 2012 10:09 pm

yeah, clouds! this is far more on the physical side than the stuff I do for clouds (I basically only create "artistic" procedural volume data that is evaluated on the fly in my volume path tracer). Thanks for sharing, it gave me a few interesting pointers to more material on the topic!! Clouds are a incredibly challenging field, simulation is complex to begin with and rendering them accurately is exactly easy either. That said I also kind of cheat on the rendering side, low maximum density, relatively low albedo, and a fake (isotropic) phase function. I also don't simulate spectral things in the clouds, although the renderer itself is spectral (since I simulate the scattering in the rest of the atmosphere and that wouldn't make much sense if it wouldn't be spectral).

Image

beason
Posts: 47
Joined: Sat Dec 10, 2011 1:58 am
Location: Los Angeles, CA

Re: Some clouds

Postby beason » Sat Jun 30, 2012 1:15 am

very nice looking!

snwy_
Posts: 25
Joined: Sun Jun 24, 2012 10:08 am

Re: Some clouds

Postby snwy_ » Sun Jul 08, 2012 11:27 am

Some tweaks to the cloud generator and the way the path tracer handles cloud masses. The cloud below is the condensation from about 0.7 billion air parcels moving through the fluid field, which is at a resolution of 200x200x200.

Image

The black spec at the upper right corner is a boundary error. There also seem to be some flaws of logic in my direct lighting code, but I need to look into that. A few apparently quite important phenomena (coalescence, entrainment) are ignored for now, but need to be accounted for somehow at some point. I'd especially want to model the droplet size distribution to some extent to generate virga. Atmospheric perspective is just a flat shade right now, which kinda makes it hard to tell depth.

What you do for clouds, necro, is far more efficient than mine. The problem for me is that, to have an interesting sky, one needs more than just one or two clouds floating around - yet even those few clouds take up a lot of processing and memory for all the 3d grids. Maybe a kinda hybrid would work: procedural cloud wisps for the high altitudes and fewer more detailed clouds for the lower ones.

snwy_
Posts: 25
Joined: Sun Jun 24, 2012 10:08 am

Re: Some clouds

Postby snwy_ » Mon Jul 09, 2012 12:44 pm

With the direct lighting code slightly adjusted, the cloud looks a bit more like it's supposed to (the sun is to the right, fairly low, and slightly 'behind' the cloud). I think there's still some problems with the lighting, but need to look into it.

Image

skydave
Posts: 2
Joined: Fri Sep 14, 2012 9:56 am

Re: Some clouds

Postby skydave » Tue Sep 18, 2012 7:00 am

Hey Guys,

I just stumbled upon this very interesting topic. Did you make any progress? The results look really promising so far.

@necro: your result is very impressive. How do you handle the cloud volume and the atmosphere? Do you have one integrator which takes both into account at the same time?

Cheers,
David

snwy_
Posts: 25
Joined: Sun Jun 24, 2012 10:08 am

Re: Some clouds

Postby snwy_ » Tue Oct 30, 2012 12:20 pm

No progress on my part unfortunately. Lost interest in it for now.

TESSELLATED TITS
Posts: 13
Joined: Wed Mar 28, 2012 12:18 am

Re: Some clouds

Postby TESSELLATED TITS » Thu Nov 01, 2012 9:08 pm

I made some raytraced clouds:
Image
it definitely is the best clouds I've ever seen in my entire life.
To achieve the transparent effect, I first select and highlight all the objects, then I hold down the rendering button and cut away the selected objects, then I take screenshot as the objects fade away! :lol:
Proud Member of Temporary replacement for ompf.org.
Conforming to the fascist rules of this forum since Wed Mar 28, 2012 12:18 am


Return to “Visuals”

Who is online

Users browsing this forum: No registered users and 3 guests