Table of contents
No headings in the article.
I believe we have all been beaten and battered by performance in Unity and this time, even what the YouTube videos do is offer little help. Look, I'm not saying their contents are not helpful or amazing. But, in most cases they're just not the solutions we need, especially if you are working on an Open World Game, with NPCs, or cars riding around the streets. The optimizations can be a mix of sweat and tears.
In my own case, my performance was below 30FPS, and I even had issues when sometimes the framerate will drop to 5-10FPS at an instant. I was almost going crazy, where do I start from? After several research and observations on my side I ended with several solutions, and which some maybe rather very unorthodox but it works! However, I'll start with the less conspicuous ones which did most of the heavy works for me.
1. Reducing Polycounts of 3D Models: this cannot be overly emphasized especially in an Open World game. Mistake we all make is trying to use very high quality detailed models or artifacts in our games which in turn can be very detrimental to our performance because the GPU it takes to render each and every Triangle and Vertex of the model. How did I fix this?
I went forward to replace the models with very high Triangles with ones with low or at least substantial polycounts while maintaining details of the objects in my scenes. In my own cars, one of my cars had a polycount of about 37.1k Tris in my scene and I had over 20 of them riding around. So you could imagine how I shot myself on the leg? I went ahead to replace it with one of 3k Tris which still had a very lovely quality. And it boosted my performance a lot.
The other technique I used was Decimation with Blender - This technique is used to reduce or lose Triangles and Vertices while still maintaining quality. Here's a the link to the video on YouTube I used
https://www.youtube.com/watch?v=N4QY-1Vf6LM
by CG Essentials
For those with no video cards like me, I suggest you use Blender 2.79b. You can't use it for rendering, so mind you.
2. X-Frame FPS Accelerator: this is a plugin or script developed by Kronnect. X-Frame FPS Accelerator is a camera script plus some shader effects that improves the FPS of your game.
The technique used by X-Frame FPS Accelerator works in two steps:
Makes the camera render to an off-screen surface with reduced resolution which obviously makes the render faster, but it also reduces any post-image effects time.
Upscales the rendered frame to window size, optionally applying MSAA antialias + our custom fast sharpen algorithm, which reduces blur and improves result vs a normal upscale operation
3. Disabling and Enabling Skinned Mesh Renderer: have you ever had issues or encountered issues with Swapchain crash in Unity which happens as a result of too many objects in Unity rendering at the same time? If you've ever working in an Open World game and you haven't experienced this yet, I'm certain in the nearest future you would. In my own case, there was too many characters in my scenes and occlusion culling wouldn't do much on this part of rendering only what the camera sees. So, in this part, you have to do it manually by writing a script to disable the Skinned Mesh Renderer or Mesh Renderer depending on which your NPC or movable objects have. Now, all you want to do is, disable the renderer of these 3D Models after a certain distance is passed or covered by the Player. You can do this by using the GetComponent(); in my case I did it in the parent object. GetComponentInChildren(); . But, for the sake of optimizing your codes, you would want to cache this component by creating a SkinnedMeshRenderer[] array.
I hope this post was really helpful.