- Home /
Unanswered but solved by rendering at half resolution
Optimizing my draw calls without success
Hello! I just recently deployed my game onto my iPhone4 and saw how the high ammount of draw calls I've had all through development came back to haunt me with crap framerate.
So I've been trying to optimize my scenes by merging textures into texture atlases, sharing materials and my latest attempt was to merge the whole level in a scene so that all objects would perhaps use one draw call.
Nothing has yet worked.
http://thatanimator.com/dump/drawcalls.jpg << higher resolution
Here is an example that I've tried to wrap my head around for a bit now.
It's a very simple scene with 4 characters that share most of their materials and textures. Each character has around 800 triangles. With only these 4 characters and their shared textures I get 15 draw calls.
Adding the level - the version that has all the trees and fences as seperate objects, gives me 41 draw calls but a managable triangle count. The 41 draw calls are absurd as the level uses one texture and material for everything except the grass and dirt/sand, which use one texture and material each.
If I instead use a merged level from Maya, one mesh with 2 textures (one for the level and one for the dirt/sand) (+ 1 texture for the grass still, which is a seperate object) I get a whooping 15k triangle count at 30 draw calls.
The merged level weighs in at 2.3k triangles and the characters at around 2.6k. How does that make up 15k?
Does anybody have any suggestions as to how I should go about optimizing my draw call heavy game? I have read through several similar questions and taken actions as adviced in those threads (merging textures, merging meshes) but as you can see from my screens, Unity seems to be trollin' me.
Any ideas please, I am right at the goal line with this game. Only hurdle are these draw calls!
Thank you!
I too am interested in anyone who has insights into lowering draw calls or other performance improvements. I have a few suggestions based on reading and a bit of experimentation, not on real project experience:
I've read that draw calls are not the end all of measurements. While they should be used as a guideline, FPS on the target device(s) is what should be measured, and FPS should measured by script.
Consider combining meshes inside of unity. There is a script for combining meshes that comes with the standard asset package: CombineChildren and Combine$$anonymous$$eshes.
In my experimentation (one scenario on device), triangle count was far less important that draw calls. I could have 20 times as many triangles in a combined mesh as in separate game objects.
hey thanks. that second point you wrote sounds interesting, might check it out!
for now though, I "solved" my horrible frame rate by building the game rendering at 320p rather than 460p. the aliasing is evident on the iPhone4, but I'm not too bothered by it. I tend to like aliasing :)
rendering at half the resolution also allows me to use the two post processing filters that I wanted to use, color correction and vinjett+blur without any significant performance issues.
I might check out the combining thing out anyway, since combining everything in $$anonymous$$aya just resulted in a super high poly level without even furstrum culling..
I'm gonna see if there's a way to close this question, even though it is unanswered.
again, thanks for the comment!
The issue is fill-rate, not draw calls. The iPhone 4 has a severely inadequate GPU considering the native screen resolution.
Follow this Question
Related Questions
Performance issues with grid based terrain 2 Answers
Server Based Networking Reduce Lag 0 Answers
"Caching" code in the Start() to run it "later" 3 Answers
GPU Other Huge spikes. 0 Answers
Performance optimization 0 Answers