Jump to content

  • Log In with Google      Sign In   
  • Create Account


Increasing performance


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Migi0027   Crossbones+   -  Reputation: 1517

Like
0Likes
Like

Posted 15 October 2013 - 02:51 AM

Hi guys. wink.png

 

What I do when drawing full screen effects, is normally to sample a full screen quad, but at the native resolution. After a while I realized that it was becoming quite slow, with multiple full screen effects.

 

How do other people accomplish a steady performance when doing these full screen effects, multiple of them?

 

Could you decrease the resolution when performing these effects, so as an example, scaling down the screen when applying the bloom effect, or when blurring something?

 

Thanks, as usual. smile.png

-MIGI0027



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 28582

Like
8Likes
Like

Posted 15 October 2013 - 05:38 AM

Could you decrease the resolution when performing these effects, so as an example, scaling down the screen when applying the bloom effect, or when blurring something?

Yes, that is quite standard. When reducing resolution, you end up with a blurry image, so it goes hand in hand with blurring. The result is a blurrier image, faster happy.png

Often for bloom, you'll copy your scene to a half-resolution or quarter-resolution target, perform the blurring passes at that res, then apply the results back over the original full-resolution target.

 

Other effects such as DOF and SSAO can also be done at half resolution. However, often with these effects have some sharp edges (an unoccluded object overlapping an occluded one, or an in-focus object overlapping an out-of-focus one) that are required to remain sharp, and not be blurred accidentally due to the low resolution.

To fix this, when you apply the low-resolution results to the high-resolution scene, you have to use a bilateral upsampling filter. This means that instead of using the built-in bilinear texture filtering, you manually fetch the 4 closest low-resolution texels, and perform some computation to see if they are "valid" or not. For example, you might compare the depth value of each of the 4 low-resolutions texels to the depth value of the current pixel being shaded. If they differ by more than some threshold amount, then you do not use them.

 

Another thing you can do to increase performance is to merge multiple effects into one. For example, say you had a post-process fog effect and a bloom effect. When you apply the bloom, it has to blend a colour into every pixel on the screen, and so does the fog. You can save some bandwidth by merging these shaders so you only blend a colour once, instead of twice in a row.

Another common candidate here is to merge DOF and motion blur into a single effect.

 

Lastly, if you want to get really fancy, you can perform tile-based post processing. This is like tile-based deferred shading. Many effects don't affect every pixel on the screen, for example, DOF does not make any changes to pixels that are in-focus.

To do this, you first calculate for each "tile", say 8x8 pixels, whether any pixel inside that tile is out of focus. If it is, you output a 1 for that tile, otherwise a 0. These results are written to a texture that is num-tiles-wide x num-tiles-high. e.g. for 1280x720 resolution and 8x8 tiles, this tile texture would be 160x90. Then when performing DOF, you first check this tile texture and early exit if it contains a 0.0 for the current pixel's tile (or skip unneeded tiles in some other way).



#3 Tasaq   Members   -  Reputation: 1200

Like
1Likes
Like

Posted 15 October 2013 - 09:17 AM

Not too long ago I asked a question about strong guassian blur with focus on performance:

http://www.gamedev.net/topic/648412-gaussian-blur-with-large-radius/#entry5098093

 

You might find it helpful :)



#4 JohnnyCode   Members   -  Reputation: 198

Like
0Likes
Like

Posted 16 October 2013 - 06:06 AM

Also, if you do not want to process entire quad, you can use stencil buffer as the reference to what pixels on screen to process. This is yet costy in case you do want to process entire quad, as this demand the stencil buffer pass to define what to shade.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS