- Home /
How can I increase the fps of my scene?
Hi everyone,
I have created a scene that contains a bunch of trees, a couple of houses and some water:
Whenever I walk through my scenes and look at the stats, I fairly often get frame rates < 20.
Here is an example:
As you can see on the picture, that Water4 I am using is currently even deactivated. It gets a lot worse with water enable.
So here is my question: What can I do to increase performance? I added object culling which works great but didn't increase the fps too much. Are there any other things I can tweak? Any input would be greatly appreciated!
Thanks, Christoph
Answer by Berenger · Jun 26, 2012 at 08:25 PM
Reduce the far distance of the camera and add some fog, so the far plane cut isn't visible. Simplify your trees, lower the quality settings.
Answer by bjenks · Jun 26, 2012 at 10:52 PM
I'm still learning how to tweak performance as well, but have been told that both baking the your primary light sources into your scene and to play around with the enviroments (tree, grass, bush's) bend factor considering the amount of tree's you have in your scene which I hear can be quite taxing on your system as well. Sorry for not posting any specifics but hopefully you have a place to start further research :D
Answer by Mortoc · Jun 26, 2012 at 09:16 PM
The simple thing I'm guessing for your scene is to reduce the LOD distance on your trees. In the scene view, check out the "overdraw" view to see how much stuff is getting rendered on your video card that you don't even see (aka, wasted framerate).
If that doesn't help you optimize you may need to implement a distance/imposter system (Pro only). This would be a lot of work.
Games like The Elder Scrolls use imposters to optimize huge open world scenes. The main idea is you make render textures that you don't update very often for stuff very far away and you only render the close stuff every frame.
Answer by Wolfram · Jun 26, 2012 at 11:19 PM
Buy a new graphics card ;-P
Or more seriously:
See the suggestions of the others, especially @Bérenger's, and the tip about baking lightsources.
But in addition to that - the number of draw calls is most likely what kills your performance (although 4.5M tris isn't bad, either - what graphics card are we talking about?). 6500 is extremely high. Try to figure out which objects are causing these draw calls, by selectively (de-)activating your objects.
Make sure your terrain pixel error is larger than one. The larger it gets, the lower will be the mesh quality of your terrain, but it will considerably reduce the number of polygons.
For your houses (=for anything unrelated to the Unity terrain and its detail/tree objects) you can optimize them by combining their meshes to reduce the number of draw calls. See Mesh.CombineMeshes, or the Unify wiki community script (or was this an old Standard Asset? not sure) CombineChildren.cs.
Make sure the meshes of the trees you are instancing are optimized similarly.
Note a standalone build will run considerably faster (sometimes an order of magnitude, at least for CPU intensive stuff, the benefit might be reduced for GPU intensive workload) than the Play mode of the editor. Not sure about the WebPlayer, but my guess it's still much faster, since the editor has the large overhead of refreshing and updating the whole Editor GUI, active inspectors, hierarchies, and possibly even the Scene view and so on.
Answer by christoph · Jun 27, 2012 at 06:21 PM
Thanks everyone for your hints and tips!
I tried multiple things:
removing all trees did increase performance :)
decrease the far plane also helped a little bit but the charm of the level was to be able to see far distant objects too
disabling shadows really helped a lot!
Given the last point, I baked a light map into the scene which replaced my dynamic shadows and voilà: I at least doubled the frame rate, if no water is visible the rate even goes up to close to 100fps.
Thanks every one for your insights!
Your answer
Follow this Question
Related Questions
FPS decreases over time in editor (Potential memory leak?) 2 Answers
GPU at 15FPS, please help 0 Answers