Advanced Tools Analysis - Lucas-van-Dam/Resonance GitHub Wiki
Description
For my school subject Advanced Tools I have researched the performance of different post processing effects, and how they scale with resolution.
Evaluation proposal: "Test the performance of three post-processing effects: Bloom and Depth of Field, by measuring how they affect frame rate and quality at different settings in a custom C++ engine using OpenGL"
Expectations: I expect bloom to have a greater performance impact, since this requires a lot of down- and up-sampling to give a nice smooth result, while both depth of field and bloom need to do blurring passes, I expect that these extra passes will increase the performance cost. I also expect Bloom to scale better with resolution increases, since bloom is fully done in half resolution, making the effects of increasing resolution less effective for increasing performance cost.
Hardware
These tests have been done on an ASUS TUF GAMING A15: Hardware Specifications
Bloom implementation
For the bloom implementation i used a technique shown in a talk done in 2014 by Sledgehammer Games: Next Generation Post Processing in Call of Duty: Advanced Warfare although i added a threshold pass to prevent the brightening of the entire image, which produced way more desired results.
Depth of Field implementation
For my depth of field implementation i used a simple 10 tap circular blur, with a depth linearization/circle of confusion pass to blur only parts of the world that are not around the focus distance.
Tests
I tested the GPU cost of the two effects in 2 different resolutions, 635 x 447 and 1355 x 656, all using the same scene, measuring the GPU time for 2500 frames. For both of the tests only the post processing effect being tested was enabled, so color correction was also disabled.
Test Scene
Low resolution
Bloom
The GPU cost for bloom is pretty consistent around 0.085-0.09 ms, there is a slight variance of around 0.005 ms, however this is in the range of far beyond imperceptible. There is a slight incline in the cost over time, over 2500 frames around 0.0025 ms, which is not much but could be a sign of a leak somewhere.
Depth of Field
Again the GPU cost is pretty consistent, around 0.04-0.05 ms, with spikes being minimal (around a variance of 0.002 ms), there is however again a slight increase in GPU cost over time.
Low res conclusion
As shown in these pictures, at low resolution Bloom indeed has more of a performance impact over Depth of Field, where depth of field holds around the 0.04-0.05 milliseconds, bloom is closer to 0.085-0.09 milliseconds, which is around double the performance cost.
High resolution
Bloom
In a higher resolution there is a noticeable increase in cost, going up around 0.04 ms (~50% increase) to 0.12-0.13 ms, with spikes of around 0.005 ms. There is once again a slight increase in cost over time, just like in the low resolution. There is a strange spike in cost at the end of the 2500 frames, which I have not found an explanation for.
Depth of Field
For depth of field the GPU cost goes up to around 0.09-0.1 ms, which is around an increase of 0.05 ms (~100% increase) with some serious spikes every now and then of around 0.007 ms, with the variance the other time is only around 0.002 ms. There is once again a very slight increase of cost over time.
High res conclusion
The bloom took around 0.12-0.13 ms per frame, while depth of field took around 0.09-0.1 ms per frame, meaning bloom has around 30% higher performance cost per frame for this resolution
Final Conclusion
In the end the bloom took more performance in both tests, however bloom did scale better than depth of field, which could be because of various reasons, namely the blurring is done over a full resolution frame instead of the half resolution blur passes that are done for the bloom, meaning that the resolution increase has less of an impact on the bloom than the depth of field. Another point is that my bloom implementation does not change the amount of downsample and upsample passes depending on resolution, instead doing a set 5 passes, while ideally it would do more passes for higher resolution, decreasing performance but increasing bloom quality.
In all of my results there has been a slight increase of GPU time per frame, this is consistent over all my effects, meaning that it most likely has to do with something internal in my engine being faulty rather than the effects itself leaking performance. The increase was not significant enough to meaningfully change the outcome of this test.
The depth of field scales around a 100% increase for around a 113% increase in resolution, which means that the depth of field scales roughly equally with resolution, giving it a scale factor of around 1:1.
The bloom scales around a 50% increase for an increase of 113% in resolution, giving it a scale factor of roughly 1:2.
This means that my original expectations were correct, the Bloom has a higher upfront cost, however it also scales better than depth of field when changing resolutions.