supertuxkart / stk-code

The code base of supertuxkart
Other
4.44k stars 1.05k forks source link

Optimise bloom #2945

Open auriamg opened 6 years ago

auriamg commented 6 years ago

As recommended by Stragus on IRC, our bloom implementation could be rewritten to be much faster

7:32:45 PM - Stragus: Dual filtering as described there: https://community.arm.com/cfs-file/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-50/siggraph2015_2D00_mmg_2D00_marius_2D00_slides.pdf 7:32:52 PM - Stragus: (Siggraph 2015 paper) 7:35:20 PM - Stragus: And I'm skeptical to see the bloom added on top of the final framebuffer just on its own. You generally want to do a single pass to merge a bunch of stuff, including the tone mapping, which seems to be another independent pass 7:35:42 PM - Stragus: A lot of stuff could be merged in a single pass, to be gentle on the framebuffer memory bandwidth

Benau commented 6 years ago

deve can you try:

<Benau> and auria for the bloom actually because it never uses alpha channel so maybe you can edit rtts.cpp make if m_bloom from rgba_internal_formal to GL_R11F_G11F_B10F
<Auria> you want me to test that?
<Benau> this can avoid rewriting the whole stuff
<Benau> esp sam adds a lensflare
<fantasmos> You kept the contents of the if statement right?
<Benau> yes auria try and see if you see noticable difference?
<Benau> no i remove the inside-contents of if
<fantasmos> because y = viewport.getCenter().Y; now needs to always occur, instead of only >3 players
<Auria> RTT_BLOOM_1024 and RTT_BLOOM_512?
<fantasmos> Ah, thank goodness. I was worried that the fix wasn't gonna work
<Benau> all of the RTT_BLOOM* RTT_TMP_* RTT_LENS_* in if (UserConfigParams::m_bloom)

in your intel / nv card?

Benau commented 6 years ago

And 1 more fun fact, actually just disable SSAO can make some lightweight track to almost 1xx fps instead of 7xfps and I have some faster wip-ssao, just disable bloom save 5-8 fps only: https://github.com/Benau/stk-code/commit/f630b79b7ccdd6cab9f962750c1f8bca7fa77682

Result (old): old_ao (my ssao): new_ao

Though my ssao way has some bug for example far-away object are darken, also it's camera angle dependent.