Metin stones and effects
I have been hearing about the performance impact of metin stones and effects since I entered the scene. But are metin stones really as heavy as many say they are? Metin stones don't appear to be complex objects but looks can be deceiving, so I decided to investigate what impact these stones (and effects) have on performance. These are the testing conditions:
Resolution: 1920 x 1080;
Map: Map A1;
Field of View: 45 degrees (vertical);
Metin stone count: 750 (arranged in a 25x30 grid, the stones are interleaved, so that they don't arrive at the renderer in an optimal order);
Clients: TMP4 (Reference); Old version of my D3D11 Renderer and the new optimized version.
Builds: All clients use Distribute.
OK with that out of the way let's start testing.
TMP4 (reference):
Metin stones only: 23 ms (~43 FPS);
Metin stones and effects: 73 ms (~14 FPS);
Yeah, performance is pretty bad.
Let's see how the old version of the renderer fares:
Metin stones only: 12 ms (~ 83 FPS), 37 ms (~27 FPS. Shadows, AO and DoF set to max quality);
Metin stones and effects: 40 ms (~25 FPS), 65 ms(~15 FPS. Shadows, AO and DoF set to max quality);
While the renderer beats reference, as soon as graphical features are activated or there are a lot of effects, the performance becomes unacceptable.
This hardware, while not high end by modern standards should be able to breeze through this test scene. So, it's time to optimize.
After working on this for weeks, these are the results:
Metin stones only: ~6 ms (~ 166 FPS, 32-bit exe); ~4 ms (~250 FPS, 64-bit exe);
Metin stones and effects: 7 ms (~142 FPS, 32-bit exe); 5 ms (~200 FPS, 64-bit exe);
This is a much, much better result. The overhead from effects became negligible, and we are able to render with graphics features set to max quality without worrying about performance. OK this is great so what are the disadvantages? When many effects are close together like this, some flickering can be observed. This can probably be mitigated by sorting the effects in a way that produces more consistent output (by distance perhaps?).
64-bit brings around 30% performance improvement, so in my opinion, it's worth it.
So that's it, the fearsome metin stones and their effects have been conquered. This should be good enough for most scenes while leaving enough performance headroom for other things.