Jump to content
  • Advertisement
Sign in to follow this  

dx9 fullscreen quad artifact (post process - glow)

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

hi, just been going back to my old dx9 renderer and adding some post process effects.

I've started on glow/bloom and for some reason I'm getting the seams of the full screen quad showing up. I've tried everything I could think of to erradicate it.

I assumed it had something to do with the halfpixel off set but every method i have tried produces the same results.
I'm downsampleing to 0.25 of the original image then bluring H, bluring V the blur H and V again. the seams start showing on the first blur V stage.

my half pixel for the vertex shader...

float2 halfPixel = float2(1.0f/(ViewportSize.x/4.0f),1.0f/(ViewportSize.y/4.0f));

applying it in the pixel shader...

UV.x = IN.Tex0.x + (1.0f * IN.Tex0.z);
    UV.y = IN.Tex0.y + (1.0f * IN.Tex0.w);

have also tried applying it to the vert pos directly in the vertex shader but same results.

I'm stumped would appreciate if anyone knows what this is and how to deal with it.

below is a pic of the full scrren quad artifact.





Share this post

Link to post
Share on other sites

Instead of drawing two triangles to the screen, draw one single oversized triangle twice the width and height of the screen with text coordinates ranging from [0.0-2.0] to repeat the texture (the extra area will be clipped away). This guarantees a continuous set of pixels get drawn, eradicating the seam.

Share this post

Link to post
Share on other sites

Have you checked you texture lookup coordinates in pixel shader. Check if they are really set for fullscreen. Check for texture coord output in vertex shader. It appears that interpolator outputs wrong numbers to pixel shader.


When using halfpixel offset it is easier for me to use something like:


float2 UV = IN.Tex0 + float2(0.49 * 1.0/ScreenWidth, 0.49*1.0/ScreenHeight);


Also check for texture sampler states like D3DSAMP_ADDRESSU, D3DSAMP_ADDRESSV

Share this post

Link to post
Share on other sites

Thanks, will have a look tomorrow to see the samplers are currently just Linear and uv are set to clamp. I may also try using a smaller viewport for the downscaled texture or reducing the quad size, not sure if that is the issue but it might be now that I think about it, the smaller texture is filling the whole screen when blurring so will try that and see.

Share this post

Link to post
Share on other sites
Hi just got another idea to your problem. Is your rectangle correctly rendered over full screen. Because from the looks of your picture it appears as if only one triangle is rendered. Check your 2d rectangles vertex and index buffers.

Share this post

Link to post
Share on other sites

reverted to doing the half pixel outside of the shader and applying to the buffer directy and only doing blur in the pixel shader...


FLOAT fWidth5 = ( FLOAT )dtdsdRT.Width - 0.5f;
FLOAT fHeight5 = ( FLOAT )dtdsdRT.Height - 0.5f;

FLOAT fTexWidth1 = (( FLOAT )fWidth5) / (FLOAT)dtdsdRT.Width;
FLOAT fTexHeight1 = (( FLOAT )fHeight5) / (FLOAT)dtdsdRT.Height;

pCamera[CameraIndex].pScreenQuadVB->Lock( 0, 0,( void** )&pVBData, D3DLOCK_DISCARD );

pVBData[0].p = D3DXVECTOR4((fWidth5+PosX), (-0.5f+PosY), 0.5f ,1.0f);
pVBData[0].uv = D3DXVECTOR2( fTexWidth1, 0.0f );
pVBData[0].c = D3DXVECTOR4(1.0f,0.0f,0.0f,1.0f);

pVBData[1].p = D3DXVECTOR4( ((fWidth5)+PosX), (fHeight5+PosY), 0.5f ,1.0f);
pVBData[1].uv = D3DXVECTOR2( fTexWidth1, fTexHeight1 );
pVBData[1].c = D3DXVECTOR4(0.0f,1.0f,0.0f,1.0f);

pVBData[2].p = D3DXVECTOR4( (-0.5f+PosX), (-0.5f+PosY), 0.5f ,1.0f);
pVBData[2].uv = D3DXVECTOR2( 0.0f, 0.0f );
pVBData[2].c = D3DXVECTOR4(0.0f,0.0f,1.0f,1.0f);

pVBData[3].p = D3DXVECTOR4( (-0.5f+PosX), (fHeight5+PosY), 0.5f ,1.0f);
pVBData[3].uv = D3DXVECTOR2( 0.0f, fTexHeight1 );
pVBData[3].c = D3DXVECTOR4(1.0f,0.0f,1.0f,1.0f);




and this gives this result with ugly line (only did one H and one V blur pass very minimal bluring to make sure i can see artifacts).




and just out of frustration i changed the code above slightly to this...

FLOAT fTexWidth1 = (( FLOAT )fWidth5) / (FLOAT)dtdsdRT.Width;
FLOAT fTexHeight1 = (( FLOAT )fWidth5) / (FLOAT)dtdsdRT.Height;

dividing both by width gave this result with no artifacts (as I manually stretched in the pixel shader, not in this picture though,to see)

but not the correct texture scale...





basically if anyone has any ideas what I'm doing wrong please let me know I've tried everything i can think of...


also some additional code being sent to the pixel shader...


float texelKernel[2*13];
float pixToTexX;
float pixToTexY;
pixToTexX = 1.0f/Width;
pixToTexY = 1.0f/Height;
float Scale = 1.0f;
Edited by David Ga11agher

Share this post

Link to post
Share on other sites

oh well I redid the post process pipeline and fully adhered to the direct3d9 example and got it working. tomorrow I will see if can do the blur on a smaller texture...

Thanks for those that tried to help.



Share this post

Link to post
Share on other sites


tomorrow I will see if can do the blur on a smaller texture...



couldn't wait, yup success! finally...this was so frustrating but glad it's outta the way.


thanks again.

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!