Jump to content
  • Advertisement
Sign in to follow this  
Xmon

Screen filling quad

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

What is the best way to create a quad that should cover the whole render target and never move; its vertex shold be positioned in the corners and it should be passed through shaders?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Static vertex buffer

Share this post


Link to post
Share on other sites
The DirectX9 SDK tutorial named "Real-Time shadowing" does render a full screen quad. Maybe it is suitable for your purpose.

Share this post


Link to post
Share on other sites
a Simple sprite should do it with the width and height of the backbuffer.
Look into The ID3DXSprite interface for Native DirectX and the Sprite class for Managed DirectX. Sprites are rendered in screen space and won't be affected by transformations so they won't move unless you really want them to.

You could also opt to go for a simple polygon made up of 2 triangles and position that accordingly.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Quote:
Original post by Armadon
a Simple sprite should do it with the width and height of the backbuffer.
Look into The ID3DXSprite interface for Native DirectX and the Sprite class for Managed DirectX. Sprites are rendered in screen space and won't be affected by transformations so they won't move unless you really want them to.

You could also opt to go for a simple polygon made up of 2 triangles and position that accordingly.

I hope this helps.
Take care.


Can I have the shaders to render the sprites?

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
The DirectX9 SDK tutorial named "Real-Time shadowing" does render a full screen quad. Maybe it is suitable for your purpose.


I did'nt found that. I just found "ShadowMap Sample" and "ShadowVolume Sample" is it any of them?

Share this post


Link to post
Share on other sites
Yes, you can use pixel shaders to render a sprite. It all depends on what states you set as a sprite will handle most (default) states itself such as T&L in some cases as it needs to be able to rotate itself to always be visible. but you could change that using some simple flags.

The simple answer is yes.

I hope this helps.
Take care.

[Edited by - Armadon on November 12, 2005 7:12:14 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Armadon
Yes, you can use pixel shaders to render a sprite. It all depends on what states you set as a sprite will handle some states itself such as T&L in some cases as it needs to be able to rotate itself to always be visible. but you could change that using some simple flags.

The simple answer is yes.

I hope this helps.
Take care.


Should I set the technique whit "VertexShader = NULL;"? I did'nt mentioned this but I also nead to know the position of the pixel on the screen sience I blend it whit a texture, can I do that whit a sprite?

Share this post


Link to post
Share on other sites
Quote:
Original post by Xmon
Quote:
Original post by haegarr
The DirectX9 SDK tutorial named "Real-Time shadowing" does render a full screen quad. Maybe it is suitable for your purpose.


I did'nt found that. I just found "ShadowMap Sample" and "ShadowVolume Sample" is it any of them?


Must be the "ShadowVolume Sample", since only those uses stencil buffering. However, here follows the snippet I mean:

Here a "ShadowVertex" array is build to cover the entire back buffer:

//Get the width & height of the back-buffer.
LPDIRECT3DSURFACE9 pBackBuffer = NULL;
D3DSURFACE_DESC d3dsd;
Device->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
pBackBuffer->GetDesc( &d3dsd );
pBackBuffer->Release();
float sx = (float)d3dsd.Width;
float sy = (float)d3dsd.Height;

// Set the size of the big square shadow
ShadowVertex *v;

m_pBigSquareVB->Lock( 0, 0, (void**)&v, 0 );
{
v[0].p = D3DXVECTOR4( 0, sy, 0.0f, 1.0f );
v[1].p = D3DXVECTOR4( 0, 0, 0.0f, 1.0f );
v[2].p = D3DXVECTOR4( sx, sy, 0.0f, 1.0f );
v[3].p = D3DXVECTOR4( sx, 0, 0.0f, 1.0f );
v[0].color = 0x7f000000;
v[1].color = 0x7f000000;
v[2].color = 0x7f000000;
v[3].color = 0x7f000000;
}
m_pBigSquareVB->Unlock();


Notice the determination of sx and sy, and the later use as co-ordinates of a quad.

Share this post


Link to post
Share on other sites
I was thinking of using D3DFVF_XYZW as the FVF flag, and just let the vertex position go through the vertex shader whitout transforming them. Is this approach corect and what values should I assign the vertex?

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!