Im working with my deferred engine in XNA 4.0 and Im combining it with a forwardpipeline to support semi-transparency and other "forward only" effects.

Let me describe what I do:

  1. Render GBuffer and all deferred geometry based on materials
  2. A final composit where I combine the lightbuffer and the diffusebuffer from the GBuffer. I output color and depth to a rendertarget so I can use forward rendering to draw directly onto that RT.
  3. Render forward geometry
  4. I then take the RT from the forward pipeline and do postprocessing stuff.
  5. Finally I write the RT to the backbuffer


  • As you can see in the image below there's a problem with the boundingboxes. The are drawn using forward rendering and is drawn using the depthbuffer I descibed in step 2. I have tried to offset the depthbuffer in different directions with a texel or two. But nothing seems to solve the problem. Has anyone experienced this problem before?

EDIT: This post has been cleaned from some statements to avoid confusion.

enter image description here

  • \$\begingroup\$ That's a really strange problem, especially since it only happens at 1920x1080. Can you put a test case online to see if it's just your hardware or an XNA problem? \$\endgroup\$
    – Roy T.
    Dec 22 '12 at 19:41

Turns out, I was wrong. The source of the problem was in step 5 where I used a shader to copy the rendertarget to the backbuffer.

I forgot to correct the texture coordinates by negative texel X and Y. Not doing this results in incorrect sampling and color data being lost because the sample was taken at the wrong texel.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.