Reflections are important in any VR application. The real world contains many reflections, so people notice when they are missing from a game or application. In this section of the guide, we focus on why reflections are important in VR and the different ways that these reflections can be implemented.
Reflections in VR can use the same techniques that traditional games use. However, the reflections must be modified to work with the stereo visual output that a user sees.
A good implementation of reflections can make an application or game feel more realistic and immersive. However, there are a few extra issues that you must consider when you implement reflections in VR. We explain these issues in this section of the guide.
Reflections using local cubemaps
One of the ways that you can create reflections is to use cube mapping. In a cubemap, the six faces of a cube are used as the map shape. The six sides of the cubemap have the environment projected onto them. The cubemap is stored as either six square textures, or is unfolded into six regions of a single texture. The cubemap is generated by rendering the scene from a given position with six different camera orientations. A 90-degree view frustum represents each cube face.
The use of local cubemaps avoids creating the reflection texture for each frame. Instead, this method fetches the reflection texture from a pre-rendered cubemap. This method applies a local correction to the reflection vector, based on where the cubemap was generated. The scene bounding box uses that information to fetch the correct texture.
Reflections that are generated using local cubemaps do not suffer from pixel instability or pixel shimmering.
Pixel instability and pixel shimmering can occur when a reflection is generated at runtime for each frame. For more information, see Implementing reflections with a local cubemap.
Combine different types of reflection
Different reflection generation techniques are required to achieve the best performance and effect. Which technique is required depends on the shape of the reflective surface, and whether the reflective surface and the object being reflected are static or dynamic? The result from the different reflection generation techniques must be combined to produce the result that the user sees. For example, in the Ice Cave demo, some reflections use a static cubemap, but the dynamic objects are rendered using a mirrored camera. These reflections are combined in a single shader. For more information, see Combining reflections.