• Advertisement
Sign in to follow this  

Render Targets

This topic is 4136 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 I know how to make a render to texture and use that to present to the screen like a back buffer etc. But what I want to know is how these render targets should be managed within the engine. For example, say I have 2 effects, one which uses a render target for drawing shadows and one for post bloom lighting, should I create a render target class that encapsulates a general render target and then create a list of those to loop through a I render my scene? If anyone else uses multiple render targets, how do you integrate them neatly into your engine? thanks

Share this post


Link to post
Share on other sites
Advertisement
It's really up to your app to decide how to use the targets. For example, you may not render to a render target each frame, only updating on occasion. You might only want to update a subsection of the target, for example, when doing an atlas of impostors. You may wish to use the same target multiple times a frame for drawing depth values for shadowing, once for each light. You may wish to use multiple render targets so you can cache the shadow depth map for use in many frames when the lights are not moving. You may ping-pong back and forth between two targets when doing post processing effects.

I used to have our engine attempt to manage all the rendering to render targets. Now it only does in a few special cases, and leaves the rest up to the game. We provide a platform independant wrapper class around the functionality we need, but it's up to the app to choose if and when to render to that texture. This leaves us open to explore new rendering techniques without worrying about changing the engine architecture every time our usage pattern doesn't match what the engine thought we'd use render targets for.

Share this post


Link to post
Share on other sites
My D3D render targets are actually just flat textures. They have a "bind as render target" member function on them. After they've been rendered to, I can bind them as a source texture just as I would any other texture.

Share this post


Link to post
Share on other sites
Hi

havent been here for a while so just thought i'ld bring my old post back from the dead lol. Anyway "Namethatnobodyelsetook" i like the idea of being able to swatch amy normal texture to a render target with a member function how did you go about implementing this? are there some DirectX functions I should know about? or do you simply create a new texture with D3DUSAGE_RENDERTARGET and lockrect it over the old textures memory?

thanks

Share this post


Link to post
Share on other sites
Hi

havent been here for a while so just thought i'ld bring my old post back from the dead lol. Anyway "Namethatnobodyelsetook" i like the idea of being able to switch amy normal texture to a render target with a member function how did you go about implementing this? are there some DirectX functions I should know about? or do you simply create a new texture with D3DUSAGE_RENDERTARGET and lockrect it over the old textures memory?

thanks

Share this post


Link to post
Share on other sites
No, you misunderstood my comment. We don't transform a regular texture into a render target. The game must ask to create a render target, and we return a texture created with the appropriate flags, but that's about the extent of what we do. Our core engine no longer attempts to decide when and what to render to any render target. The game, or a game specific renderer extension, must specifically choose when and what to render to a RT texture, which may be several times a frame, once a frame, once every few seconds, when a light has been moved, or whatever. There are so many possible usage patterns, such as deferred rendering, shadowing, cube reflections, planar reflections, impostors, post FX, etc, and so many possible tradeoffs in how to approach these, that we don't try. The game chooses whatever is most appropriate for it.

We give back a platform independant wrapper around the RT texture, and provide a platform independant method to set the current render target(s), and that's it for the core engine. We don't manage their usage, as we would inevitably be imposing some arbitrary limitation that wasn't anticipated.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement