Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Correct view for fullscreen quad


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 StanIAm   Members   -  Reputation: 208

Like
0Likes
Like

Posted 07 November 2013 - 04:06 PM

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 !



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31926

Like
2Likes
Like

Posted 07 November 2013 - 05:00 PM

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).



#3 Adam_42   Crossbones+   -  Reputation: 2619

Like
1Likes
Like

Posted 07 November 2013 - 05:33 PM

If you're using DX10 or higher you don't even need a vertex buffer. http://www.altdevblogaday.com/2011/08/08/interesting-vertex-shader-trick/






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS