Advertisement
KillaMaaki

Explanation of mobile GFX test

Dec 28th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. A bit of an explanation of how this demo is doing things...
  2.  
  3. 1.) SSAO
  4. Screen-space ambient occlusion in this demo was based on the technique used in Modern Combat 5, as presented by Gameloft. It's a pretty simple and cheap technique that only needs a depth texture. SSAO is rendered to a half-res R8 buffer.
  5.  
  6. 2.) Bloom
  7. Just your bog-standard bloom, really. Takes the screen, renders the screen to a half-res ARGB32 buffer (while applying a min/max brightness value, so anything under min is black and anything above max is white), then performing an iterative box blur on the result. A little crappy hack I did was to also start by blitting SSAO into the alpha channel in that first pass, so that while blurring the bloom I could blur the SSAO buffer too in the same passes.
  8. A final pass combines the bloom buffer with the screen, summing the RGB channels and multiplying the A channel (for AO).
  9.  
  10. 3.) Motion blur, tonemapping, & color grading
  11. I actually apply motion blur, tonemapping, & color grading all in the same shader in one pass. First, I apply a simple naive motion blur based on velocity per pixel fetched from Unity's motion vector buffer (9 samples per pixel). Then, I pass it through a tonemapping function borrowed directly from Uncharted 2. I then perform a lerp between the greyscale of the pixel and the color of the pixel based on an explicit Saturation value passed to the shader. Finally, RGB channels of a simple 1D lookup texture are fetched (pretty much like encoding a Levels filter in a lookup texture).
  12.  
  13. 4.) Fake eye adaptation
  14. In the video I show off faked eye adaptation, which was actually inspired by an effect in the Unreal Sun Temple demo. My tonemapping already supports an Exposure value. So, I created a trigger system. As a camera passes through an exposure trigger, the trigger stores exposure values at the start and end of its own Z-axis. A trigger is placed filling the tunnel in the demo, with the end towards the back set to 1.0, and the exposure exiting the tunnel set to 0.25
  15.  
  16. 5.) A few extra notes...
  17.  
  18. It's probably obvious, but I'm running the game at a very low resolution - specifically, I'm running it at 800x450. Mobile device RAM is still slow as all hell which becomes one of the primary performance limiting factors in terms of fullscreen post processing (the 808 isn't that far behind a PS3 in terms of GFLOPs, and has a higher GPU clock speed, but phone VRAM is absurdly and hilariously slow by comparison).
  19. It's also running on ES3.0, and absolutely will not run on ES2. Then again, ES2 is pretty damn old so it's not that surprising (actually, more than half of all Android devices now support ES3 or higher).
  20.  
  21. I would also like to note that I intentionally framelocked the demo to 30. While technically it actually is capable of running at a full 60 (or at least, last I checked), device heat is a major issue in this regard. Early tests had my phone aggressively throttling GPU clock speed as the temperature rose, which caused performance to dip considerably and, due to VSync, resulted in constant micro-stuttering. Running at 30FPS not only reduces heat, it's also lighter on the device even if/when it DOES heat up enough to trigger throttling (even reaching 40C, well above the point it had previously throttled my 60FPS test, did not appear to affect framerate whatsoever).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement