It’s hard not to know that virtual reality is the latest craze in training and simulation. The appeal of VR is obvious – instead of building huge domes or surrounding a student with screens, VR offers a solution that is much more portable, and even more immersive – all while leveraging low-cost consumer hardware to keep costs down, too.
Sundog Software’s been keeping up with the times, and we’ve spent a lot of time inside our Vive Pro headset making sure the SilverLining Sky, 3D Cloud, and Weather SDK and the Triton Ocean SDK both perform well in VR environments. Developing in VR presents its own unique challenges; here are some tips for getting the most out of our libraries with stereoscopic vision.
Make sure you’re using the latest build of SilverLining.
Many of SilverLining’s clouds are composed of 2D billboards, and 2D billboards are notoriously hard to handle in VR. You can’t let the billboards just point toward the two different cameras for each eye, or they won’t line up properly. Recent builds of SilverLining change the way in which billboards are handled to be VR-friendly – so if you haven’t updated lately, be sure to do so before supporting VR in your app. You’ll want at least version 5.038 for VR apps.
Be careful to pass in the correct viewports and camera matrices.
Both SilverLining and Triton offer methods for specifying the view and projection matrices and viewport. You’ll need to make sure the correct matrices and viewport are in place for your left and right eyes before you render the sky, clouds, or ocean. This often means re-architecting integrations that update these matrices in separate threads from where the drawing is done. If you’re retrieving shadow maps from SilverLining, you’ll also need to take care to maintain separate matrices for applying that shadow map for each eye.
Take advantage of Triton’s thread-safe rendering.
Remember newer versions of Triton now include the ability to draw multiple views simultaneously. If you render your left and right eye views concurrently, Triton can integrate into your renderer using our new concurrent API’s.
Consider single-pass stereo rendering with user shaders
OpenGL users might want to look at the new GL_NV_stereo_view_rendering extension. Both Triton and SilverLining offer mechanisms for extending our shaders, and you could use these hooks to integrate this extension into our clouds and water. We know of at least a couple of customers doing this.
Start without spray in Triton
As we said, 2D particles can be problematic in VR. You can use the Triton::Ocean::EnableSpray() function to disable spray effects while VR is in use, if necessary. If your app is VR-only, the Triton.config settings “fft-enable-spray” can be set to “no” to also gain quite a bit of performance back – and you need all the performance you can get with VR!
Squeeze out all the performance you can
High framerates are critical to immersive VR. Be sure to review our tips for optimizing SilverLining’s performance, and use Triton’s Ocean::SetQuality method to make the right tradeoffs between speed and visual quality.