7
\$\begingroup\$

I want to know how the algorithm works in this game: http://www.gametrailers.com/user-movie/cloud-the-game/45068

Especially how the game generates the real time cloud, and be able to merge with other clouds dynamically.

I tried to google some info, but was unable to find the useful information. Probably because I used to wrong keywords

\$\endgroup\$

2 Answers 2

13
\$\begingroup\$

Cloud rendering is hard task. But those clouds in video are just couple of "cloudy" particles. I don't think that that is something nice :)

For nice clouds problem is not the cloud simulation, but the cloud rendering, which is impossible to handle to be photo realistic in realtime for scene with dynamic lighting. What happens in participating media like cloud is: enter image description here

Light emission exist only when participating media emits light (like hot gas or fire) or when they are lighted (this is simalar part to normal rendering), absorption mean that light is absorbed and scattering is the biggest computational problem. Light is scattered inside the volume. Then you want to have self shadowing and shadow emmiting to the ground and opaque scene. How to do it?

Where to obtain cloud? Clouds can be simulated by perlin noise. It is very common and looks nice. Perlin noise can be 4D, where 4th dimension is time to create nice dynamic clouds. If you want to specify cloud shapes: you have to do volumetrization over the desired shapes, save it as density 3D grid and multiply it with perlin.

How to render it

By rendering particles?. Particle clouds are possible. It is most simple method. However, simulation of any light propagation between particles is pretty hard. It is very typical that you have to sort particles in the view direction of camera ( or in so called half-axis between camera-dir and light-dir). This is impossible in realtime application unless your target platform doesn't support shader model 4 or better shader model 5 - and gpgpu computing (like cuda, openCl or direct compute) - so you could write Parallel radix sort and sort particles every frame (that will be realtime). Sorting is needed for alpha blending and also for smart shadow mapping.

I'll guide you to some articles:

By volumetric raycasting. Volumetric raycasting means, that you have grid where you did fluid simulation (typicaly Navier-Strokes, but voxelized cloud shape is ok too). And shoot ray for every pixel through volume and integrate radiance across the ray. This is suprisingly OK for realtime applications. Raycasting on wiki. You don't have to have gpgpu computing. Volumetric raycasting can be done on pixel shader, because it doesn't need any synchronization between threads (rays). Having grid in 3D texture is perfect on graphics hardware, because you can benefit from native tri-linear interpolation of the texture unit. Self shadowing can be done by shooting ray from every sample to light and counting the density of light shadowing volume. This is slow. You could use some shadow mapping with transitions (like deep shadow maps). The light scattering is also not possible in realtime (with gpgpu it is).

Volumetric raycasting is fast and it is easier to implement than particle sorting and work fast even on older HW.

Something to study:

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the detailed information. For our purpose, the cloud will need to morph into a shape we specified. So I think we can use Perlin Noise 3d grid using particles. Lighting, even by volumetric raycasting, is probably prohibited, because mobile platform is our tergeted platform. \$\endgroup\$
    – Leo
    Commented Mar 14, 2011 at 12:27
  • \$\begingroup\$ What about the kinds of clouds in Lumion? They're not fly-throughable, but look gorgeous. vimeo.com/12173355 \$\endgroup\$
    – George R
    Commented Sep 4, 2011 at 3:03
5
\$\begingroup\$

I can't speak to the details of Cloud, but clouds are usually implemented using three dimensional Perlin noise. From the video and my recollection, Cloud "merges" the clouds by just making your cloud bigger and removing the other one.

Ken Perlin's original noise presentation uses clouds as an example.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .