# Skylight color calculation

This topic is 4959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there any way to calculate the color of sun/skylight on clouds? Any papers on this? As my sky color model I'm using "A Practical Analytical Model of Daylight". I have a cloud system working nicely but I want to find what color I should use for the clouds depending on the time of day, the position of the sun, altitude of the clouds etc.. anything to make it look realistic. My other option would be to construct the color table myself but that requires too much artistic creation of my lacking self. I guess it would be easy to use pictures but the altitude affects the color in a rather unique way and I don't think I'd find enough photos for that.

##### Share on other sites
Hi.

I wrote an article on realtime clouds lighting in Game Programming Gems 5 (see this page for shots). Essentially, you have to do raytracing from the sun to the cloud voxel, and compute the cloud color based on the distance that the sunlight travels.

=[dEkS]=

##### Share on other sites
Quote:
 Original post by deksHi.I wrote an article on realtime clouds lighting in Game Programming Gems 5 (see this page for shots). Essentially, you have to do raytracing from the sun to the cloud voxel, and compute the cloud color based on the distance that the sunlight travels. =[dEkS]=

Wow, that's so awesome!

1. Does the raytracing take care of calculating the color not just the shading?
2. For the cloud color before shading do you start out with the color in the skydome at the sun?
3. What sky coloring model do you use? (looks like "Practical analytical model of daylight" to me.

I don't have shaders but some kind of CPU raytracing should work. The technique I use (Harris) to shade the clouds does calculate the scattering integral without raytracing, but only calculates shading, the color is given by artists.

##### Share on other sites
Quote:
 Original post by Ilici1. Does the raytracing take care of calculating the color not just the shading? 2. For the cloud color before shading do you start out with the color in the skydome at the sun?3. What sky coloring model do you use? (looks like "Practical analytical model of daylight" to me.

1-2. Yes. The color is (lighting_integral * suncolor) + some tweaks based on elevation/angle.

3. You're right. :) The sky color is precomputed though, but usnig Spherical Harmonics scattered through the day and interpolating the SH coeficients would do the job pretty fast IMO.

=[dEkS]=

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634090
• Total Posts
3015432
×