Version 6.38 of the SilverLining Sky, 3D Clouds, and Weather SDK now includes an integration example for the open-source Diligent Engine! We’re excited to to open up support for this fast-growing cross-platform engine.
In the SDK’s sample applications, you’ll now find a modified “cube” tutorial project from Diligent that illustrates integration of SilverLining’s physically accurate skies and 3D volumetric clouds into Diligent’s OpenGL, DirectX 11, and Vulkan modes (we do not currently support DirectX 12, although it may be possible to use “Direct3D 11 on 12” functionality for this.)
The screenshot above shows SilverLining’s clouds integrated into the more complex Atmosphere demo that comes with Diligent.
Studying the sample will be the easiest way to get started with integrating SilverLining with your own Diligent-based application, but a few important notes as you do so:
- If you are using Vulkan, it is important to enable scissoring on your pipeline state object, and set a scissoring rectangle using IDeviceContext::SetScissorRects each frame. SilverLining also requires you to pass in the current VkCommandBuffer prior to drawing the sky or clouds via the SilverLining::ThreadCameraStreamData::SetStream() method; this can be obtained from your IDeviceContext as illustrated in the sample’s DrawSilverLining method. The second parameter to SetStream() indicates the index of the current swap chain image; we couldn’t find a good way to retrieve this from Diligent, but in most cases just passing 0 will work as Diligent typically seems to do simple double-buffering.
- Initialization of SilverLining will vary based on the renderer being used. Refer to the sample’s InitializeSilverLining method for details on how to obtain the various parameters required in each case.
- Another Vulkan-specific problem is that you must initialize SilverLining with the VkRenderPass you want to associate it with. This means the pipeline state object you wish to integrate our sky and clouds into must be created before you can instantiate SilverLining. If creation of your PSO’s is deferred until later (as it is in the Atmosphere demo), then setting up SilverLining must also be deferred. And if your PSO changes, you will need to create a new SilverLining::Atmosphere associated with it as well.
- SilverLining is a low-level rendering library that manages its own drawing; as a result, Diligent has no direct knowledge of any rendering state it may have modified. If you are drawing anything after SilverLining, you may need to use IDeviceContext::InvalidateState() and re-set any required state of your own prior to doing your own drawing.
- Don’t forget to modify the SILVERLINING_RESOURCE_PATH definition in the sample to point to the location of where you installed SilverLining’s Resources directory. You can leave the license information as-is if you are just evaluating SilverLining.
- You’ll find that synchronizing SilverLining’s modelview and projection matrices with your application is pretty straightforward. Refer to the SyncSilverLiningMatrices method in the sample.
Refer to the readme file in the sample folder for build instructions and more details.
SilverLining offers much more than what is illustrated in this sample, but this provides a good starting point. You can retrieve simulated lighting conditions for a given time and place, enable precipitation effects, simulate skies for any conditions, and choose from a wide variety of cloud types. If you’re new to SilverLining, be sure to look through the SilverLining documentation to understand the depth of its capabilities.
A free evaluation SDK of SilverLining for Windows or Linux may be downloaded at https://sundog-soft.com/evaluation-downloads-silverlining/