Page 1 of 3

Ifu - cloud simulator and renderer

Posted: Mon Sep 01, 2014 10:51 pm
by snwy_
Wrote a program to simulate and render clouds; it has an easy-ish GUI and a fair bit of freedom to customize the simulation.

Website & download: Ifu - cloud simulator/renderer (Linux/Windows 64-bit)
Changelog/release notes: Changelog.txt
Video tutorials: Ifu Silent Basics - YouTube

A sample cloud for quick test rendering is included in the download.


The program is in beta, has been tested more thoroughly on Linux than on Windows, and may have a number of bugs etc. Always see the changelog, first. Rendering, clouds tend to be best viewed so that the sun is somewhat behind the camera.

The simulator runs a Navier-Stokes fluid solver and does a bunch of other stuff. Not 100% realistic, but decent. The renderer is a normal path tracer, the clouds being rendered with a rough approximation of Mie scattering (non-spectral). There's currently no in situ tonemapping; renderings can be exported into PFM.

Both the simulator and renderer are CPU-only, and heavy on the computations. They run fairly well on a Xeon E3-1230 v3, but not too quickly on an Athlon 64 X2 6000+. The simulator doesn't benefit much from multicore - memory access bottleneck. The renderer should scale up reasonably well with many cores, though odd things may happen if you have a few hundred.

Re: Ifu - cloud simulator and renderer

Posted: Tue Sep 02, 2014 3:03 pm
by raider
Hm... looks really nice. Where are you going to use that code, any plans?

Re: Ifu - cloud simulator and renderer

Posted: Tue Sep 02, 2014 11:52 pm
by snwy_
Thanks - no other plans for the code. It's been coming together slowly for a few years for personal interest, and I assume it'll keep getting updated every now and then for the same reason. The option for higher-resolution fluid grids (more detailed clouds) is next on the list of updates, and ought to be done sometime this month.

Re: Ifu - cloud simulator and renderer

Posted: Tue Sep 09, 2014 3:58 am
by snwy_
Ifu is in its 3rd alpha release. Customizable (higher/lower) grid resolution, improved sunlight rendering, and a bunch of other things are what's new.


Descriptive bug reports are encouraged.

A reminder to Linux users to set execute permission for RENDERER/sso-pathtrace as well - saves you an error message later.

Re: Ifu - cloud simulator and renderer

Posted: Mon Sep 22, 2014 12:45 am
by snwy_
Ifu is now in beta (and had a fourth alpha release in the meantime).

Find the changelog here: Changelog.txt

I've updated the first post accordingly.

Descriptive bug and usability reports are encouraged.

Re: Ifu - cloud simulator and renderer

Posted: Fri Oct 17, 2014 6:54 am
by citadel
Impressive cloudy look. I have something different though, using path tracing +
woodcock tracking (according to Steve Marschner's notes on volumetric path tracing
and also implementation from Mitsuba renderer).
I wonder the difference because mine doesn't look as sky-ish.


1)Is it the data
I use a single albedo for each channel across the whole volume, and the sigma_t
is linear to density. Albedo is close to one.
2)Is it the phase function
Is it a huge boost to use Mie scattering?
I tried Henyey-Greenstein with strong forward peak and used a higher sigma_t,
but it's too transparent in the thin parts. So I settled for spherical PF with
a reduced sigma_t.
3)Is it the lighting
I know it's index-matched and ready for direct lighting or importance sampling,
but I prefer to use a soft(but still HDR) environment map first. Ifu seems to
use a strong light?

Could you add this feature to export the volume data to another format, say ascii.

Thank you for your impressive work.

Re: Ifu - cloud simulator and renderer

Posted: Sat Oct 18, 2014 1:30 pm
by snwy_
The clouds are saved in relatively straightforward binary, something like this:
[char - file version; here 'A']
[int - number of triangles in the 3d cloud mesh]
[float*12*number of triangles - the 3d triangle mesh; 3 vertices + normal]
[int*3 - resolution of the simulation grid, x/y/z; here z=y=x=simulator resolution]
[float*x*y*z - cloud-water content in each cell of the simulation grid]

The last two entries are what you want for the raw volume data. It's saved in the format of 'for (x){ for (y){ for (z){ data[INDEX(x, y, z)] } } }', where the data is indexed into as (x+(y*resolution)+(z*resolution*resolution)).

Most of the cloud rays in Ifu scatter forward, very roughly approximating Mie scattering. The chance for a ray to scatter when inside a cloud is determined by the amount of cloud-water in that cell, and some modifications to the phase function are made based on that chance (going along the simplified assumption that droplets are larger where there's more cloud-water, which isn't the case in real life).

Sunlight is a sort of simplified photon map, where at each scattering the direction of the sun ray is saved into the map. When tracing eye rays, the direction of the ray is matched at each scattering to the directions of the various incoming sun rays from the photon map to approximate how much sunlight is scattered in the direction of the eye ray.

Re: Ifu - cloud simulator and renderer

Posted: Mon Oct 20, 2014 5:27 am
by citadel
Thanks for the explanations.

I trust that cloud is a very complicated medium and cannot be handled trivially.

I'm particularly interested in the look of a cumulus cloud,
where the bright parts have clear contrast with the self shadowed regions.

I've experimented a little and find that using Henyey-Greenstein phase function
favoring backward scattering (I use g=-0.7), allows a similar look.

I think a perfectly forward scattering (or close to) medium can't mimic the look of realistic
thick clouds because the reduced sigma_s is (1-g)*sigma_s (imagine a perfectly forward
scattering cloud with no absorption, sigma_s is reduced to zero thereby render the cloud
totally transparent), and in the case of cumulus clouds backward scattering weighs more.

test_00000dl_d_additional_linear_gamma_1_maximum_2.02983_minimum_0.png (459.19 KiB) Viewed 12731 times

Re: Ifu - cloud simulator and renderer

Posted: Mon Oct 20, 2014 7:41 am
by citadel
I have made a serious mistake that I did not use HG phase function but spherical one for direct lighting.
This is to some extent causing my confusion.

Re: Ifu - cloud simulator and renderer

Posted: Mon Oct 20, 2014 5:00 pm
by snwy_
Some dissertations on cloud simulation/rendering that may give ideas are Harris (2003), Bouthors (2008), and McLoughlin (2012). I think Bouthors was most concerned with rendering cumulus clouds. Might also look at Display of Clouds Taking into Account Multiple Anisotropic Scattering and Sky by Nishita etc. for potential ideas or sources.