Model and draw calls

I have a simple model(3d cube). I spawn a lot of model with different textures.
In profiler i get about 150 draw calls.
When i spawn models with same textures i get 10 draw calls.

So what to do?
1)If i have different predicate to texture is that help me?
2)Now i changed model to 4 sprite. It need additional work but i have 10 draw calls, and can play animation.
3)Any other ways to increase performance with models?

This post is a good start Draw calls and Defold

Having more render predicates will not help with performance it may even lower it.

If you have 150 models and they all have different textures you will end up with 150 dc because of the state changes. If you want to lower your draw calls you could try using sprite sheets for them, as far as I know this is not supported by Defold.
You will have to make them yourself in photoshop buy combining a lot of model textures and then move your UVs to match up again.

10 draw calls is not a lot, if your game is laggy it is probably something else. I haven’t done a lot of tests with models myself so unfortunately I am not sure how to optimise them fully.

Is your game slow with the models now or are you optimising before it gets slow?

2 Likes

My game is slow in HTML build. I have 20-30 ms per frame. The problem is with graphics in profiler. Usually graphics take 6-8 ms(I have 16ms frame). But sometimes it take 12-16 ms. In PC graphics is near 1ms or faster.

I reduce draw calls from 150 to 10, I think it gave me few ms, not more.

Are you running the debug or release version of the HTML5 engine? If you launched it from “Build HTML5 and launch” menu option it is in debug mode, which has not as good performance as the release mode. (This also applies to HTML5 engines built with native extensions for now, we have an issue for this.)

1 Like

Ok i think it fix it. Not sure because in release no profiler :grinning: . But feels better

1 Like

Awesome! :slight_smile: You could try running the debug version if you want the profiler, but disabling the graphics call check, see this topic:

3 Likes