
184 II Lighting and Shading
float2 texcoords = input . tex . xy ;
// Unpack c l i p pos i tion from texcoords and depth .
float depth = depthBuffer . SampleLevel ( pointSampler ,
texcoords ,0.0f );
float4 currClip = unpackClipPos ( texcoords , depth );
// Unpack into previous homogenous coordinates :
// inverse(view projection) previous (view projection ) .
float4 prevHomogenous = mul ( currClip ,
invViewProjPrevViewProjMatrix);
// Unpack homogenous coordinate into clip −space coordinate.
float4 prevClip = float4 ( prevHomogenous . xyz /
prevHomogenous . w ,1.0f );
// Unpack into screen coordinate [−1, 1] into [0 , 1] range and
// flip the y coordinate.