Jump to content
  • Advertisement
Sign in to follow this  
Aqua Costa

Too many render targets...

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

1- If I want to perform Gaussian blur I need a render target to render the scene, another render target to apply horizontal blur, and then I use the default render target to apply vertical blur and present the scene in the screen.

2 - If I want to down sample my scene to calculate the luminance to perform tonemapping I need a lot of render targets...

3 - And many other effects need multiple render targets...

So, what should I do? Should I create a render target manager class to manage the render targets and re-use them?

Can you give some advice?

Thanks in advance...

Share this post


Link to post
Share on other sites
Advertisement
Find Frank Luna's "Intorduction to 3D Game Programming with DirectX 9.0c: A Shader Approach". Then take a look into the chapter called "Render to Texture".

He shows how to write a render-target manager.

hth.
-R

Share this post


Link to post
Share on other sites
So, what should I do? Should I create a render target manager class to manage the render targets and re-use them?
Yep, I've seen a "render target pool" in quite a few engines before.

Usually something like a post-processing effect will request the resources (RT's) it needs from the pool, do it's work, and return them to the pool afterwards so other effects can re-use them.

Share this post


Link to post
Share on other sites
I know how to create a render target manager...

Well basically what I was asking is:

Imagine I want to apply gaussian blur and color correction post process to my scene. I need 3 render targets and the default one. One for rendering the scene, one to apply the horizontal blur, another one to apply vertical blur and then I use the default render target to apply color correction and present the scene in screen.

Or should I re-use a render target? (use the first render target to apply the vertical blur)

Share this post


Link to post
Share on other sites
You should reuse them, if it's possible (if they have the same properties and if you don't need the content of them all at the same time).
If you want to apply 3 effects in a succession, like for example H blur, V blur and color correction, while each effect is applied on the result of the previous effect, you need only 2 render targets and not three. You would need only 2 even if you had 10 effects in sequence :)

Share this post


Link to post
Share on other sites
My advice is to make your rendering framework able to be configured, so that you can easily switch between different combinations of render targets being reused or not. As a reference, you can take a look at how my IRenderView classes work in my engine (linked below). In general, it should be pretty easy to create an object that performs the configuration and rendering of your scene. Then you can simply create multiple versions of the object that try different ways of connecting the render passes together.

It is pretty hard to say if using fewer render targets is better than using more of them. If you fit within the memory budget of the target hardware, then it could very well be a performance benefit to use more render targets so that there is no contention for a reused one. It all depends... the best way is to profile a particular situation and understand if that particular scene needs special handling...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!