Jump to content
  • Advertisement
Sign in to follow this  
Hyunkel

[DX10] deferred shading msaa using custom texture resolves (speed up)

This topic is 2903 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 implemented msaa in my deferred renderer using custom texture resolves, however it is quite slow.
This was to be expected since you have to run anti-aliasing on all G-Buffer textures and the DepthStencil buffer as well.

Without AA my application had average frame times of ~0.009ms (110fps)
Setting the textures to 4xMSAA, but only taking a single sample from each texture resulted in ~0.016ms (60fps)
Running 4xMSAA on all mentionned textures resulted in frame times of ~0.02ms (50fps)
Using dynamic branching to only take multiple samples from edge pixels resulted in ~0.019ms(51fps)

This is quite a performance hit.
As can be seen using dynamic branching isn't really helping at all.
I was thinking about running some sort of pre-pass to mark edges using the stencil buffer, but if I go that road, I have to run the lighting calculations twice, once with aa and once without, so this can't be any faster.

I'm quite surprised by going from 0.009ms to 0.016ms just by changing the texture formats so they store multiple samples.
This also seems to indicate that whatever I do, I can't get any faster then 0.016ms (60fps) since I don't really do any anti-aliasing at that point.
On the other hand I was also surprised that quadrupling the lighting calculations only resulted in a minor drop (0.016ms to 0.020ms)


One useful thing I found is CSAA
Which allows higher levels of AA using no more then 4 samples.
So I can actually use 16xCSAA at the same speed as 4xMSAA, but this is for Nvidia cards only.

Any ideas on how to speed things up?

Cheers,
Hyu

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Hyunkel
This also seems to indicate that whatever I do, I can't get any faster then 0.016ms (60fps) since I don't really do any anti-aliasing at that point.

At that point you also spent the time to generate those additional samples. But you could be right, that this is the minimum performance penalty you have to pay.

Share this post


Link to post
Share on other sites
I have quite a basic deferred renderer for a project I'm working on and I've given some thought to this matter but unfortunately I don't have the time to look into it myself right now.

If you were to pass some sort of edge detection filter that gives you back orientation over the depth map you could then use the orientation to blur the edge pixels between the differing depths as a post-process step after lighting.

I have used such filters before via shaders but never actually took the time to measure how expensive this pass would be. It might give a good enough look for a lesser performance loss then your msaa method.

Share this post


Link to post
Share on other sites
Quote:
Original post by Darg
I have quite a basic deferred renderer for a project I'm working on and I've given some thought to this matter but unfortunately I don't have the time to look into it myself right now.

If you were to pass some sort of edge detection filter that gives you back orientation over the depth map you could then use the orientation to blur the edge pixels between the differing depths as a post-process step after lighting.

I have used such filters before via shaders but never actually took the time to measure how expensive this pass would be. It might give a good enough look for a lesser performance loss then your msaa method.


I'm pretty sure that a doing a post-process blur on the edges will be much faster.
In fact it's the only way to go if you program for dx9, since it doesn't support custom resolves.
There was an article about it in gpu gems 2, related to deferred shading in stalker.

I was hoping to use "real" anti-aliasing though.

Share this post


Link to post
Share on other sites
I would definitely at least try using a stencil mask. You'll be doing 2 passes, but in most cases you should only be shading pixels once due to stencil culling.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!