I've tended to the code for sun update... I have made changed to headers and sources with "Atmosphere" in them. There is no more sun movement bug, however I find the code EXTREMELY messy (like mine before) so I will go through it cleaning up pazystamo's original code etc.
I will also be working towards implementing atmospheric scattering on both the ground and the sky and providing the texture for cheap reflections for nodes (by name, something like "skyDomeScatter"), so you can use it. I have reworked my shader which doesn't have pixel distribution issues anymore (stereographic projection of hemisphere on a circle which is then morphed to a square). I have provided source in there
After that I will resume cleaning up and introduce options to make the cloud textures higher resolution with more particles, also I will add batched and hardware modes for billboards in the clouds. Then I will slowly implement techniques from Flight Simulator, first being the octagonal ring of impostors to make the cloud cover even thicker.
http://www.mediafire.com/?6rnjfn5xnjsnec6
EDIT: I came up with a basic idea of my algorithm
GroundScatter+ThroughLighting(a.k.a. rimlighting)+ThroughDiffuse+Ambient+DiffuseReflectance
The ambient term doesnt require explanation
Basically the water droplets in a cloud do two things, diffract and reflect light.
The light from the skydome is reflected by the cloud, the thing is that the cloud has no explicit normals and the light is reflected from everywhere. However we can define that the light reflected from the center of the cloud is blocked or outscattered by the thickness of other droplets between it and the camera. Also light from the skydome is unlikely to reach the droplet through the other side of the cloud.
Therefore we can model the cloud with a bounding ellipsoid (like bbox and sphere), for each fragment/vertex we can compute a normal describing a hemisphere on a tangent plane based on the direction from center of the elipsoid. This can all be approximated by a spherical harmonic of the skydome with optimized updates, the coefficients can be read back with a WARPED normal which would mean that a wider angle of the harmonic would be read back. However the ellipsoid cannot take extremes of the cloud into account (like really far out puffs) so statistical measures must be taken into account ((2-3)*standard_deviation of distance from center being the ellipsoid's radii). This then means we can attenuate the reflected skydome light by the length of the ray passing from the surface of the elipsoid to the vertex/fragment raised to the power of a reflectance exponent and then multiplied by a constant and with an added constant unique for each cloud. If we imagine the exponent as gl_FrontMaterial.shininess, the constant as "specular" and the added constant as some other value. Then clouds full of snow and ice can be really reflective and thick heavy storm clouds can not be reflective.
Next up we have the clouds scattered lighting, two kinds. From the sun straight to your eye through the cloud and from the sun to the cloud diffracted out in many ways to your eye. We must trace a ray through the cloud from the sun to the current vertex/pixel and through the cloud to the eye, this is computationally weird. We simply cant do it realtime, however we can represent each billboard with a sphere and group the smaller spheres together into elipsoids so we dont run out of frame time or instructions. We precompute the opacity/optical depth of the billboards by marching through their textures and calculating an average
O = (E(areaoftexel/PI*(1-alpha)*(k-grayscale)))*c
where k is a constant, c is another constant. We can then scale that by the diameters for each elipsoid obtaining an optical depth in 3 directions.
Now for the beautiful part, we trace the ray through the cloud's elipsoids and get the length of the ray inside each of them. The opacity cast by the puff will equal O*diameter/length, the opacities received by many puffs will sum up. Then the diffuse light of the sun will equal sunDiffuse-sunDiffuse*sumof(Opacity for the sun to fragment ray) clamped to a minimum of 0.0 which can be attenuated by the dot-product of the sun and the normal we used in looking up the skydome reflectance.
The story is similar with the RimLighting/ThroughLighting, but the light received by sunDiffuse-sunDiffuse*sumof(Opacity for the sun to fragment ray) is attenuated by the exponential (again shininess) cosine of the angle between the sun-to-frag and camera-to-frag rays and the summed opacity of the puffs between the fragment and the camera. Here I must make an amendment to my idea about SH reflectance from skydome, the camera opacity to fragment reflecting light will be the same as here instead of the one through the crude ellipse.
I may experiment with attenuating both ThroughLighting and ThroughDiffuse by the angle between the camera ray and the normal of the point where it comes out of the cloud and the same for the camera ray however I think it wont produce reliable results.
The scatter term will be done like for terrain scattering but I may use the data from the above to sample scattering directly through the cloud and treat it more like an atmosphere.
I should yield a result close to this