I have a meeting with Paul on Monday to test the game in the HIVE. Its running pretty slowly just now – about 15fps – and I’m worried its going to take a big hit to the frame rate as the HIVE’s resolution is 3200×1200.
As such, I’ve gone through and tried to identify areas that are causing the game to slow down and fix them. At first, the game was at 15fps and the draw and GPU threads were running at about 60ms per frame each.
I identified one of my problems as being overdraw, with a large amount of transparent textures in the scene. My first solution to this was to make sure all of my emissive and particle materials were set to unlit. This didn’t give me a huge performance boost – maybe 5ms on the draw thread – but its best practice anyway.
The next overdraw issue was the large amount of static mesh grass in the scene. I deleted this and replaced it with instanced foliage meshes. Again, maybe a 5ms boost at most but still a good thing for the game.
Not getting as much as I thought I would out of the stat unit information, I found on the documentation that there’s a GPU profiling tool. I ran this, and saw that one of the biggest issues on the GPU was a single point light. It was static and didn’t seem any different from the rest of them, but deleting it didn’t make too much of a difference to my lighting and reduced my draw by 40ms!!!! This was really surprising. I’m not sure, but I think it may have had something to do with overlapping lighting and dynamic shadows trying to generate on top of precomputed ones.
I then looked at the second biggest thing on the list, and felt really stupid for not remembering about it. I had real time reflections in the game. The entire scene was being rendered twice per frame, no wonder my GPU wasn’t happy! I was disappointed to have to do this, as the reflections look really lovely, but I changed my scene capture texture to take one snapshot, rather than updating every frame. Again, this reduced the thread significantly, getting my GPU from 69ms to 35ms, which is about 30fps. Not amazing, but many AAA games run at 30 due to the need for a “cinematic experience” (not sure if that’s true for every game…) so I’m happy to do the same.
Surprisingly, particle optimisation hasn’t been an issue. I presumed I’d have to do some serious LODing of my particles and was dreading it, but most of them run of the CPU and the game thread stays at about 20ms so that’s fine. The frame rate will only be as high as the slowest thread, and the GPU isn’t getting any higher, so I don’t see the need to reduce the time taken on the game just now.