Realistic visual simulation of the sky and clouds is a difficult task, when faced with real-time performance constraints. Sundog Software’s SilverLining offers DirectX9 and OpenGL developers on Windows a shortcut for performant and visually convincing 3D clouds, tied together with a physically-based simulation of the sky.
Although 3D clouds and a realistic sky are a necessity for flight simulators, SilverLining offers a nice touch of reality for any application that renders interactive outdoor scenes. Makers of outdoor sports games, urban simulation programs, driving simulators, and military training systems are among the people who are integrating SilverLining into their applications. In addition to rendering the sky and clouds, SilverLining also simulates the natural outdoor lighting sources for your application given any time and location – an important part of rendering realistic outdoor scenes, especially those that are rendered at different times of day. It provides illumination from the sun and moon, day or night, and even handles tone mapping effects.
SilverLining starts off by calculating the sunlight and moonlight in the scene, which is later used to light any clouds, and to provide lighting information for lighting the rest of your scene. For any given time, location, and simulated weather conditions, the simulation starts with first principles – the spectrum of light from the sun and moon from outside the Earth’s atmosphere. The location of the sun and moon relative to your position on the Earth is computed, and a rigorous simulation of how this light scatters through the atmosphere is conducted that ultimately leads to the spectrum of scattered and direct sunlight and moonlight at the Earth’s surface. This information is then used to simulate how this light is distributed throughout the sky, in real-time, using vertex shaders on systems that support them for added speed.
This means you’ll get red sunrises and sunsets, accurate blue gradients in the sky during the day, and a dark blue sky at night, all based on a real physical simulation. SilverLining also applies a tone-mapping operator to handle the fact that light during the day is many orders of magnitude brighter than at night, which is a range far beyond what any monitor or projector can display. The way your eye adapts to light is simulated, so nights with a full moon will still appear bright, for example.
In addition to the sun and moon, the positions of all the visible stars and planets are also simulated for nighttime scenes. A simple atmospheric scattering model is applied to the visual magnitudes and colors of each star and planet on systems that support vertex shaders. You’ll get a reddish Mars that even appears brighter when it’s closer to Earth, for example. A glare simulation is also employed via a fragment program, so that bright stars and planets on dark nights will have the same glare you’d see with your naked eye. Starlight, moonlight, earthshine from the moon, and planetary and galactic light all contribute to the lighting of nighttime scenes as well. It’s these little touches that add to the realism of scenes rendered with SilverLining.
All of these lighting computations are ultimately used to light the clouds within the scene. SilverLining supports the visual simulation of the common cloud types:
The clouds are procedurally generated, so no two clouds look the same - adding to the realism. Each cloud is "grown" using a cellular automata for the cloud type, and the placement of each cloud is also based on a simulation based on a studies of cloud distribution in cumulus cloud decks across the world.
3D clouds have always been notoriously difficult to do in the face of 60 frames-per-second performance requirements. While SilverLining’s performance will vary based on the system it’s running on, we’ve seen reports of solid 85 frames per second from the demo application, which features fly-throughs through thick decks of cumulus congestus clouds.
Some of the tricks used to maximize performance include the use of custom vertex shaders to perform the billboard effects on the puffs that make up each cloud, compiling each cloud into a single triangle strip, and rendering distant clouds as “dynamically generated imposters,” which is a technique to conserve fill-rate.
Since SilverLining offloads as much of the sky, star, and cloud rendering as possible to the graphics card in the form of vertex and fragment programs, plenty of CPU time is left over for rendering your own scene. The demo at Sundog’s website features 3D clouds over a multi-threaded geo-specific terrain engine over Seattle to demonstrate that real-time performance is achievable for an entire outdoor scene that includes 3D clouds and a physically simulated sky.
A configuration file allows users to tweak SilverLining to achieve their own trade-offs between visual quality and performance, if necessary. Licensees also have access to the full source code to enable any further optimizations that may be necessary for special situations.
SilverLining is a C++ class library for Windows that was designed with ease of integration as its primary consideration. Extensive documentation is provided along with sample code for both DirectX9 and OpenGL developers. Libraries are provided for debug and release single-threaded and multi-threaded DLL and static runtimes, under Microsoft Visual Studio 6, 7, or 8. Integration comes down to just four simple steps, and most folks are up and running within a day:
Lighting and fog information is accessible to the application programmer for rendering the rest of the scene in a manner consistent with the rendered sky.
While this suits the needs of most developers, others wish lower-level access to more tightly integrate SilverLining’s objects into their own rendering engines. Access to individual cloud objects is provided through the API, and as mentioned before, full source code is provided to licensees to enable any custom integration required.
The SDK is freely available to anyone to ensure it can be smoothly integrated with your applications before you even think about purchasing a license for it. Sundog Software offers free pre-sales technical support in case there are any questions while evaluating SilverLining. If you find yourself hooked, a variety of pricing options are available for royalty-free, single application licenses to fit most professional budgets.
SilverLining has seen seven minor revisions already in response to customer feedback, and Sundog Software continues to listen to what new features people want to see. On the horizon is precipitation effects, continued perfecting of the lighting model, and of course the addition of more types of clouds and refinements to the ones currently offered. Simulation of fog and haze has also been requested. Finally, SilverLining was written with portability in mind, so ports to Linux, MacOS, and DirectX10 will be undertaken as customer demand dictates.
Sundog Software provides its updates free of charge to licensed customers.
Ultimately, Sundog Software plans to offer a sky and cloud rendering solution for game consoles and offline renderers as well. If you’d be interested, let them know!
SilverLining by Sundog Software is a unique product that offers a commercially available SDK for fast, realistic rendering of the sky and everything in it. It allows you to leverage Sundog Software’s three man-years of development on this project, and frees up your own developers to work on making the core of your application the best it can be. Check out the demo, and give the SDK a try for free.