Sunday, April 17, 2011

Sky's the Limit

After a long hiatus from programming, I've recently started back up with the terrain project. I've been working mostly with atmospheric effects. My first goal was to fix some annoying problems with the water shader. The worst one was where the normal map stopped doing its job when the directional light pointed straight down. Per-pixel Fresnel calculation turned out to be the solution. I spent some time tweaking the coloring of the water as well.

The biggest improvement is the new and improved sky shader complete with sun, moon, clouds, and stars. These are all procedurally drawn in the pixel shader. This allows for various visual characteristics to change depending on what's going on in the sky. The sun moves across the sky and changes color based on the diffuse sky color. I've included a sequence of screenshots, showing the effect throughout the sunset.

The clouds are just two octaves of perlin noise with a very subtle animation to give them some life. I've also added stars, which are procedurally generated by filtering/gating a perlin noise texture. The stars and clouds also happen to do an excellent job of disguising the ugly color banding that occurs at night.









Starry Night