Jump to content
  • Advertisement
Sign in to follow this  
Jack Bartlett

Questions about multiple render targets

This topic is 3561 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 working on a program that renders a scene and full screen quads to texture render targets and a back buffer for some post process effects. I'm not sure about the following two things when 2 or more texture render targets are involved. 1). Where to call the BeginScene() and EndScene() pair. 2). Design of overall rendering routines. My current rendering system works like this.
SceneManager::Render()
{
  // set texture render target ...(1)
  PostProcessEffectManager.BeginRender();

  // set texture render target ...(2)
  AnotherPPEffectManager.BeginRender();

  // BeginScene()
  // render all the 3D objects in the scene ...(3)
  // EndScene()
  RenderScene();

  // restore the render target changed in (2)
  // BeginScene()
  // apply some effects on the texture on which the scene was rendered in (3)
  // render the fullscreen quad with the scene texture ...(4)
  // EndScene()
  AnotherPPEffectManager.EndRender();

  // restore the render target changed in (1)
  // BeginScene()
  // apply some effects on the texture on which the post-processed scene was rendered in (4)
  // render the full screen quad with the scene texture
  // EndScene()
  PostProcessEffeectManager.EndRender();
}

1). For a long time, I had been calling BeginScene() in (1) and (2), then just I found that second and subsequent calls are failing since they are nested. So I'm thinking of moving the calls like the code above to fix the problem, but is it required to call BeginScene() and EndScene() pair for every render target? At least, in one of the Direct3D SDK sample, 'HDR CubeMap', the BeginScene() & EndScene() pair is called every time the texture render target is set and the scene is rendered to each of the 6 cube map surfaces. I changed the sample to call BeginScene() & EndScene() pair only once at the start and at the end of OnFrameRender(), and the program worked just fine. If I have to call the pair only at the start and at the end of SceneManager::Render() above, it would simplify my code, but I'm not sure if it is okay to do so. At least, that's not what the official sample of the SDK does. 2). Also, I'm not really sure if the rendering code above is the right way to manage multiple render targets. I would appreciate any advice. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
My first idea would to have a loop of render targets

for every render target
RenderStuff(&RenderTarget);


the main issue with this would be.. if you had dependant renders (which you most likely will depending on what effects your going for) then you just need to sort render order based on dependancies some how.. im sure you could come up with that answer.

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!