Looking to maximize your FPS when using the SilverLining Sky, 3D Cloud, and Weather SDK? We’ve made SilverLining highly configurable, so you can choose your own tradeoffs between visual quality and performance. Here are some tips for turbocharging SilverLining in situations where performance is critical.
Update: Even more tips here!
Faster Cumulus Clouds
If you’re seeing a slowdown when lots of cumulus congestus clouds are in the scene, there are a few things you can do:
- Reduce the size of your cloud layer. For viewpoints near the ground, a length and width of 50,000 meters is usually sufficient. From the air, 100,000 will generally do. The number of clouds required to fill a cloud layer increases with the square of this dimension, and so it’s very important not to use a cumulus cloud layer that’s bigger than it needs to be.
- Configure SilverLining to use fewer cloud puffs. Open up the file resources/SilverLining.config in a text editor, and look for the setting for
cumulus-congestus-voxel-dimension. Try setting it to a larger value, such as 500. This controls the size of the individual puffs that make up each cloud, and the larger they are, the fewer are needed to represent a given cloud.
- Don’t render cloud puffs that can’t be seen. In resources/SilverLining.config, set
cull-interior-voxelsto “yes”. This will prevent puffs in the middle of clouds that can’t be seen anyhow from rendering. It may affect the accuracy of cloud lighting, but in most situations you won’t notice.
Speeding Up Lens Flare
SilverLining is always conducting occlusion tests against the sun when it is in view – this is to prevent lens flare from appearing when the sun is obscured, and also to ensure that Atmosphere::GetSunOcclusion will always return a valid value. However, these tests can block rendering, sometimes for several milliseconds.
If you are rendering your scene to a framebuffer and not to a texture, and you are using OpenGL, SilverLining has an accelerated version of these occlusion tests that will not block. In SilverLining 3.040 or newer, find the setting
lens-flare-use-pbo in the resources/SilverLining.config file, and set it to “yes”. This can make a huge difference in situations where it works.
If you’re not planning to use lens flare or Atmosphere::GetSunOcclusion at all, you can get an even bigger speed boost (regardless of your setup or renderer) by setting
disable-lens-flare to “yes”.
Minimizing VRAM usage
In situations where video memory is tight, SilverLining’s clouds can sometimes push your system over the edge. Once your system starts paging video memory, performance will tank at best, and your drivers may crash at worst.
If you aren’t using SilverLining’s HDR mode, you can save some VRAM by configuring SilverLining to not use floating point color information in its vertices – and there are many, many vertices that make up a cumulus cloud layer.
To do this, you’ll need to rebuild SilverLining from source, and so you’ll need a source code license. Contact us about upgrading if necessary.
What you need to do is create a file called SilverLining_Vertex_Solution_Defines.h alongside the solution file you’re working with that includes SilverLining’s projects. This file should contain the following line:
You can conserve further memory by using half-precision floats for texture coordinates as well:
Then, rebuild SilverLining as well as any renderer DLL’s you are using (ie, SilverLiningOpenGL). Replace the renderer DLL in your SilverLining/resources folder with the new one you built, and link against the new SilverLining library you made. This will minimize SilverLining’s VRAM usage, giving you more headroom before performance and stability becomes an issue.