Jump to content
  • Advertisement
Sign in to follow this  
StanIAm

Correct view for fullscreen quad

This topic is 2077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

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
Sign in to follow this  

  • 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!