Graphics Reference
In-Depth Information
Once the light buffer is rendered, it is possible to apply screen-space operations to
the contents of the light buffer to simulate more complex light interactions. For example,
a bilateral blur can be used to simulate subsurface scattering for skin and other translucent
materials (Mikkelsen, 2010).
11.3.4 Rendering the Final Pass
In the final pass, opaque scene geometry is rendered for a second time. The vertex shader
is quite simple, as it only needs to pass along the mesh's diffuse map texture coordinate to
the pixel shader. The pixel shader samples the light buffer based on the screen-space posi-
tion of the pixel being shaded, and the values in the light buffer are combined with material
albedos to determine the final color of the surface. The shader in Listing 11.6 demonstrates
this concept.
// Textures
Texture2D DiffuseMap : register( t0 );
Texture2D LightTexture : register( t1 );
SamplerState AnisoSampler : register( s0 );
// Constants
cbuffer Transforms
{
matrix WorldMatrix;
matrix WorldViewMatrix;
matrix WorldViewProjMatrix;
};
cbuffer MaterialProperties
{
float3 SpecularAlbedoj
}
// Input/Output structures
struct VSInput
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORDS0;
};
struct VSOutput
{
float4 PositionCS : SV_Position;
float2 TexCoord
: TEXCOORD;
};
struct PSInput
Search WWH ::




Custom Search