Cloud rendering and the relativity of whiteness

Here are some philo­soph­i­cal and ren­der­ing-relat­ed ques­tions that I took home from the last vaca­tion. What’s the col­or of clouds? The stan­dard answer would be, white. What’s the col­or of snow? Again, white. Ok, then look at the fol­low­ing pic­ture, where the snow seems con­sid­er­ably whiter. This is the case in almost all pho­tos that I took.

There is an image on Wikipedia from the same gen­er­al area on which the bright­ness dif­fer­ence between clouds vs snow is even more pro­nounced. If you look at the direct­ly lit parts of the snow and con­sid­er it white (#ffffff), then the direct­ly lit parts of the clouds are at most 50% grey (#bbbbbb). Is that an evi­dence of air pol­lu­tion? Unlike­ly! (At least not in Tyrol).

Snow can be con­sid­ered isotrop­ic and lam­bert­ian, if it is not total­ly com­pressed to a smooth sur­face. I found some BRDF mea­sure­ments for snow in [1], and they indi­cate it’s pret­ty much lam­bert­ian. This means that, to a first approx­i­ma­tion, snow reflects light equal­ly well in all direc­tions. This is evi­dent in real life when try­ing to make out the con­tours of runs when direct sun­light is miss­ing. It is nigh impos­si­ble to esti­mate the slope visually!

Things are dif­fer­ent with clouds. Most of the time, the size of the water droplets is larg­er than the wave­length, so Mie scat­ter­ing takes over. This makes them strong for­ward-scat­ter­ers, as illus­trat­ed in this hum­ble drawing:

Now, if most of the ener­gy is scat­tered for­ward, it has to be miss­ing when seen from the side, right? As a con­se­quence, the shad­ow behind a cloud should be lighter than the shad­ow behind the sol­id object, even though the cloud is ful­ly opaque. And so it is, see again the Wikipedia pho­to and com­pare the bright­ness of the cloud shad­ow with the bright­ness of the moun­tain shadow.

Things are dif­fer­ent of course, if your view­point is inside the for­ward scat­ter­ing lobe. The next pho­to was tak­en just min­utes before the first one, while still in the val­ley. This is, rel­a­tive to the loca­tion of the first pho­to, down the hill to the left. Did I say strong for­ward scattering?

Lessions for Rendering

Clouds and fog vol­umes, even when real­ized with par­ti­cles, need a for­ward scat­ter­ing term. This can cheap­ly be approx­i­mat­ed with (\vec{V} \cdot \vec{L})^n, where n is an expo­nent that is some­how depen­dent on the thick­ness or den­si­ty. It is very sim­i­lar to a nor­mal­ized Blinn-Phong dis­tri­b­u­tion. Below is some pseu­do code that illus­trates the gen­er­al idea. Even when com­bined with dead sim­ple, pla­nar cloud tex­tures, the results can be stun­ning (see here and here for exam­ples real­ized in Spell­force 2).

half transmittance = exp2( - cloudtexture.a * somefactor );
half exponent = 32 * transmittance; // some magic number
half intensity = ( exponent + 1 ) / 2; // cheap normalization
half3 color =
    cloudtexture.rgb * ( pow( max( 0, dot( V, L ) ), exponent ) * intensity );
half alpha = saturate( 1 - transmittance );
half4 result = float4( color, alpha );

References

[1] Hud­son et al., “Spec­tral Bidi­rec­tion­al Reflectance of Antarc­tic Snow: Mea­sure­ments and Para­me­ter­i­za­tion”, J Geo­phys Res (3) 2006
http://www.npolar.no/npcms/export/sites/np/en/people/stephen.hudson/Hudson06_BRDF.pdf

Ein Gedanke zu „Cloud rendering and the relativity of whiteness

  1. Very nice! I just tried this with a very sim­ple tur­bu­lence noise func­tion and even that looks very cloud like! I’m quite amazed at how much that piece of shad­er code adds to a image.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Please answer the following anti-spam test

Which thing makes "tick-tock" and if it falls down, the clock is broken?

  1.    table
  2.    ruler
  3.    watch
  4.    pencil
  5.    chair