Graphics Reference
In-Depth Information
Implementing dual paraboloid environment
mapping
For this recipe, we extend the geometry shader's instancing approach to create environment
maps that were introduced in the previous recipe, Implementing multithreaded cubic
environment mapping , and generate a dual paraboloid environment map. A dual paraboloid
map (DPM) requires only two render targets instead of the six used in the cube maps,
therefore requiring less texture memory. However, there is also no built-in hardware support
for sampling a DPM that instead requires a manual implementation of the sampling based on
the reflection vector.
Getting ready
We will start with the finished result from the previous recipe, Implementing multithreaded
cubic environment mapping .
How to do it…
In order to generate the dual paraboloid map, we will apply geometry instancing and fill two
render targets. To sample the environment map for reflections, we will implement a new HLSL
function that determines the location and the texture (half of the DPM) to sample.
1. We'll begin by creating two new HLSL files: EnvironmentMap.hlsl and
DualParaboloidMap.hlsl . The first of these will include the common HLSL code
for use when generating or sampling our environment maps. The second file will
include the code necessary to generate our DPM.
2.
Within the EnvironmentMap.hlsl file, add the reflection texture array and the
following constant buffer:
// Texture array for Dual Paraboloid map
Texture2DArray Reflection : register(t1);
// Dual Paraboloid Map view and near/far distance
cbuffer PerEnvironmentMap : register(b4)
{
float4x4 DualMapView; // for sampling
float NearClip; // for depth
float FarClip; // for depth
};
 
Search WWH ::




Custom Search