Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About HarishGadhamsetty

  • Rank
  1. I am following GPU gems tutorial for motion blur. I am unable to understand how to get depth buffer texture. // Get the depth buffer value at this pixel float zOverW = tex2D(depthTexture, texCoord); // H is the viewport position at this pixel in the range -1 to 1. float4 H = float4(texCoord.x * 2 - 1, (1 - texCoord.y) * 2 - 1, zOverW, 1); // Transform by the view-projection inverse. float4 D = mul(H, g_ViewProjectionInverseMatrix); // Divide by w to get the world position. float4 worldPos = D / D.w; // Current viewport position float4 currentPos = H; // Use the world position, and transform by the previous view- projection matrix float4 previousPos = mul(worldPos, g_previousViewProjectionMatrix); // Convert to nonhomogeneous points [-1,1] by dividing by w. previousPos /= previousPos.w; // Use this frame's position and last frame's to compute the pixel velocity float2 velocity = (currentPos - previousPos)/2.f; // Get the initial color at this pixel float4 color = tex2D(sceneSampler, texCoord); texCoord += velocity; for(int i = 1; i < g_numSamples; ++i, texCoord += velocity) { // Sample the color buffer along the velocity vector float4 currentColor = tex2D(sceneSampler, texCoord); // Add the current color to our color sum. color += currentColor; } // Average all of the samples to get the final blur color float4 finalColor = color / numSamples; This is the code mentioned in the GPU gems tutorial.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!