Jump to content
  • Advertisement
Sign in to follow this  
vidalsasoon

Q on rendertargets for post-processing effects

This topic is 4833 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 have a quad that I can output textures too. this works. I would like to put the device rendertarget on this quad instead. (some post-processing effects like blur, bloom, shadows etc) I'm having trouble implementing this. Should I SetRenderTarget() once at the device init or every frame? Once my game objects are all put in the rendertarget I GetRenderTarget() every frame to apply my postprocessing effect on it? What does the "BackBuffer" have to do with this? Is the backbuffer the unmodified rendertarget or "default"? Typing this down I realized that I think I should be using the backbuffer to only render my quad with the texture of the rendertarget on it.

Share this post


Link to post
Share on other sites
Advertisement
First, store a pointer to your backbuffer (you're gonna need this later):

IDirect3DSurface9* backBuf;
device->GetRenderTarget(0, &backBuf);


Now, at the beginning of frame, you use SetRenderTarget to an offscreen rendertarget you have created earlier:

device->SetRenderTarget(0, renderTargetTexture);


At this point, draw everything you want to the texture. After that, set render target back to backbuffer:

device->SetRenderTarget(0, backBuf);


Now render fullscreen quad, with renderTargetTexture as texture, and with a post-processing pixel shader of your choice.

I hope this clears things up a bit. [smile]

Share this post


Link to post
Share on other sites
that helps :) followup question!

lets say I wanted to add shadows AND a bloom effect, I assume I would have to create extra rendertargets but how would I combine them into one texture for my quad?

V.

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!