Massive draw calls from nothing?
So my vr game has been having performance issues. today they got worse and i discovered that if you open a blank project, the draw frame is 16 ms(+-2). The gpu frame time is the same and the game frame time is 2ms. If you run the game in selected viewport, the draw frame time goes down to 0.05ms? what could be causing this?
edit: here is the profile
If you see the draw calls and draw frame time while on editor, you are getting the results of everything that is being displayed, including gizmos, overlays, sprites, etc. Everything you see on editor is contributing to this result.
When you play in editor, the draw frame time goes down because you are no longer rendering those editor only elements. This is the result that will be closer to you playing your actual game in your device.
Remember also that if you change your view to see more or less of your scene, your draw calls will update accordingly, so it is a dynamic value that you have to keep track of at all times, sampling views that for example might reflect the max. number of objects your user will be able to see at a given point. Also take into consideration that using dynamic lightning will increase the number of draw calls that you make, so try to use static lightning whenever possible, on as many objects as you can.
As a tip on improving performance, I will asume that you are keeping track of your draw calls because you are developing for mobile as that's where they matter the most. In my experience, static batching is what helped me the most to optimize my game. Dynamic batching doesn't work well on mobile and if it did, I believe the CPU cost of doing it on runtime would offset the time gained by reducing draw calls anyway, so it is not the way to go. If you are doing, for example, foliage painting, you are probably getting this and you are not improving performance as much as you think; might actually be making it worse.
On the other hand, doing the batching by hand and not on runtime gave me all of the gains I was expecting. That means creating a new Static Mesh asset for the group of objects you want to group and render on one draw call. Luckily, you can do this easily within the editor.
In the editor preferences/Experimental, enable the Actor Merging tool. Now, on your Window menu, you will find this tool that will help you easily take actors that have been placed in your level and replace them with a new Static Mesh asset that will have them grouped. That is the way to go on effectively reducing draw calls on mobile. Deciding which objects to batch will be a matter of balance and case by case consideration.
All other optimization tips apply, like staying away from translucent materials to avoid overdraw, and (if on mobile) never doing UV's operations on the UV inputs of your texture but doing them on the Custom UV channel of the material instead (so, on your vertex shader instead of the pixel shader).
Hope this helps. All the best.
Optimization is definitely out of my comfort zone, but since you are working on VR I have to ask. Is your GPU up to par? We have no base comparison to a blank non-VR project so for all we know that number could be the standard for your machine. We also don't know your environment.
answered Aug 10 '16 at 04:28 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here