Jump to content
  • Advertisement
Sign in to follow this  
Paul7

Screen Aligned Quad *SOLVED*

This topic is 5054 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

I`m trying to create the glow effect as described in GPU Gems. Basically I get two textures one with the back buffer contents and the other with the glow effect. These then need additively blending to produce the screen contents. My question is how do I go about mapping these two textures to the screen. Do I need to create a quad in the position of the screen to map them on to. If so how do I go about doing this and aligning it perfectly? Thanks. [Edited by - Paul7 on December 15, 2004 7:09:45 AM]

Share this post


Link to post
Share on other sites
Advertisement
In the Post process sample that comes with directx 9 it appears to create the quad like this:



const D3DVERTEXELEMENT9 PPVERT::Decl[4] =
{
{ 0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITIONT, 0 },
{ 0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 },
D3DDECL_END()
};

PPVERT quad[4] =
{
{ -0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ pd3dsdBackBuffer->Width - 0.5f, -0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f },
{ -0.5f, pd3dsdBackBuffer->Height - 0.5f, 0.5f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f },
{ pd3dsdBackBuffer->Width - 0.5f, pd3dsdBackBuffer->Height - 0.5f, 0.5f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f }
};






And then when the textures are blended it copies this using stretchrect() back to the backbuffer.

Can anyone explain how this method creates a quad that is aligned with the screen? thanks!

SOLVED- I figured it out now, I just need to create a quad in the ranges 0-1 in x and y and pass that to my pixel shader without any multiplication by view/projection matrices.

[Edited by - Paul7 on December 15, 2004 9:31:01 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!