Sign in to follow this  

MSAA Tutorial for DX9 Forward Renderer

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

You don't have to do anything in the shader to make MSAA work with forward rendering. You simply render to a render target or a backbuffer with MSAA and the D3DRS_MULTISAMPLEANTIALIAS render state is set to TRUE, and it works.

If you're only rendering to the backbuffer, just make your backbuffer MSAA by setting the MultiSampleType member of D3DPRESENT_PARAMETERS to something like D3DMULTISAMPLE_4_SAMPLES. IF you're rendering to a render target, you need to first make your renderable surface with MSAA by using IDirect3DDevice9::CreateRenderTarget. Then you also create a render target texture (with the same size and format) using CreateTexture. Then at runtime, you render to the MSAA surface first and then use StretchRect to resolve the MSAA surface to your non-MSAA render target texture.

Share this post


Link to post
Share on other sites
Thank you very very much!

One last question with the fixed function pipeline gone does this simplicity in anti aliasing go aswell in DX10? I see D3DRS for the multisample level which makes me think this will be gone with the FFP when I upgrade to 10 which would explain the large amount of tutorials on it for 10 that are around on google. Can you verify that?

Share this post


Link to post
Share on other sites
That state is still there in D3D10, it's part of the rasterizer state. For basic forward rendering the process is still the same.

The only time you need to anything with MSAA in shader is if...

1. You use texture atlases, and want to use centroid sampling to avoid artifacts at triangle edges
2. You doing some kind of deferred rendering
3. You want to do a non-standard MSAA resolve

If you don't need to do any of those things or don't know what they mean, then you don't have anything to worry about it.

Share this post


Link to post
Share on other sites

This topic is 2658 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this