Jump to content
  • Advertisement
Sign in to follow this  
codingsolo

[Problem] Rendering to Surface : renders pixels that should be occluded

This topic is 4088 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 am new to doing post-process effects and am trying to piece together what I have found thus far on the internet. When I render it to the quad, it draw the entire mesh without accounting for the depth buffer. Am I doing things in the wrong order? Pseudo of my render code: 1. I sort all my Renderable objects in a priority queue, the ones that are going to be rendered to the offscreen surface are given most priority. 2. only the player's mesh is identified to use the offscreen surface, so only one object at this time.
[source="cpp"]
d3ddevice->clear();

while (objects in queue)
{
  if (object is using the offscreen surface)
  {
    object->BeginScene()
    d3ddevice->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0);
    ... draw it ....
    object->EndScene(D3DX_FILTER_NONE);
  }
  else
  {
    if (object is the first one to NOT use the offscreen surface)
      d3ddevice->BeginScene()

    ... draw it...
  }
}

// now having rendered the surface to texture first and then 
// drawn the rest of the scene, I render the textured quad to the screen 
// in screen space

.. draw quad with the offscreen texture on it ..
 
d3ddevice->EndScene()
d3ddevice->Present()


Anyone see anything outright wrong with the way I am approaching this? Thanks for any input. Brandon

Share this post


Link to post
Share on other sites
Advertisement
I don't see that you're setting the device's texture via Device.SetTexture. Or the RenderTarget via Device.SetRenderTarget(int, surface).

Also, you're clearing the device twice and from what it looks like, the same surface.

Hope that helped.
Devin

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!