Jump to content
  • Advertisement
Sign in to follow this  
Mark Tanner

How to create a new render target with antialiasing (FSAA)?

This topic is 4867 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, Some effect I am doing in DirectX9 (HDR lighting but doesn't really matter for this issue) requires a second render target. But I need to keep antialising/FSAA (MULTISAMPLE_xx) support. If I create the second render target with CreateTexture, I cannot specify any multisample type. If I create it with CreateRenderTarget it is possible but I only get a D3Dsurface, not a D3DTexture which I need.. Surely this is pretty simple and possible? I mean a lot of effects require a second render target? (I just need to render the scene to the custom render target first with FSAA, apply some effects and render it to the backbuffer.) Thanks for any ideas, Mark

Share this post


Link to post
Share on other sites
Advertisement
To be honest I can't remember the finer points of which combinations do work... but there are general issues with having multisample/AA'd render targets - in some cases it's just plain not allowed, and in other cases it's driver dependent (and I don't think theres good support across the board).

You might well find that it's just not possible to do what you want [sad]

hth
Jack

Share this post


Link to post
Share on other sites
Thanks. But having a render target is really, really common for fx. And FSAA is mandatory nowadays. There must be a way to do both.

If you create a render target with ->CreateRenderTarget(), this returns a surface for which you can enable FSAA; but how can you use it as a texture? I mean, set it in texture stage 0, set some special fx texture in stage 1, etc.

Does anyone know?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I believe this is posible, first you have to create the render surface how you said, so then you have a D3DSurface, then you also must create a texture using:

Deivce->CreateTexture(width, height, usage, format, pool, IDirect3DTexture9 **ppTexture, HANDLE *pSharedHandle)


this will give you a texture but after creating the texture you have to add this

Texture->GetSurfaceLevel(0, &your suface)


then when you render

Device->SetRenderTarget(0, your surface);

then clear and render whatever you want, after that

Device->SetRenderTarget(0, backbuffer);

and just render your texture to the backbuffer, it will contain what you rendered to your surface

just to let you know, i have done this beore and it does work, but i don't know if it works with your shader

Share this post


Link to post
Share on other sites
This is the only way I know of doing it.

1) Create your render target using CreateRenderTarget() with FSAA and render to it as you would expect.

2) Create a texture using CreateTexture() specifying the D3DUSAGE_RENDERTARGET flag.

3) StretchRect() your render target from (1) to your texture created in (2).

-Mezz

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!