Sign in to follow this  

Screen Aligned Quad *SOLVED*

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

This topic is 4748 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.

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