Skip to main content
1 of 2
János Turánszki
  • 3.1k
  • 3
  • 18
  • 24

You should do Output.Pos2 = Output.Position in the vertex shader, then in the pixel shader:

float2 screenPos; screenPos.x = Input.pos2D.x/Input.pos2D.w/2.0f + 0.5f; screenPos.y = -Input.pos2D.y/Input.pos2D.w/2.0f + 0.5f; 

To get correct screen space coordinates you have to do your w divide in the pixel shader. After that your return should function correctly:

return tex2D( g_SamplerMultiplier, screenPos ); 

I hope I could helpp you.

János Turánszki
  • 3.1k
  • 3
  • 18
  • 24