Sign in to follow this  
StanIAm

Correct view for fullscreen quad

Recommended Posts

Hey guys I'm on creating a post processing pipeline and after a long day of work I can't find a solution for my problem.

I create a quad with 6 vertices/indices with a texture ( + rendertarget,shaderresource,sampler) , set the rendertargets before scene rendering , then I render the normal scene....after that I disable the Z Buffer, set the backbuffer as target, set the Constantbuffers for the quad ( Worldmatrix -> Identity, View -> like all other objects , projection -> XMMatrixOrthographicOffCenter(-1,1,-1,1,0.1f,100.0f) ) and the shaders + shaderresources... everything works , my quad shows the rendered scene but when I rotate the camera the quad don't remain at fullscreen, but moves like the normal view does... I think I have to fix the plane to the cameras view or what does I have to do now I really don't know :/

 

Thank you !

Share this post


Link to post
Share on other sites

I like to completely ignore the "camera" (view/projection/etc matrices) in my fullscreen shaders.

 

The job of every camera matrix (view/proj/etc) is to transform coordinates into clip-space/NDC space. Basically xy=[-1,-1] is one corner of the screen, and xy=[1,1] is the other corner.

Instead of using a matrix/camera to transform your quad so that it ends up with it's corners at [-1,-1][-1,1][1,1]and[1,-1], you can just hard-code those positions in your vertex buffer. Then in your vertex shader, you can just output the vertex position without any modification (don't multiply it with any matrices).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this