We’re currently working on a student project which has environments built out of modular assets. However, one of the issues we’re concerned about is the draw calls we’re generating.
We’ve tried a number of processes to optimise this, but they all seem to have drawbacks.
CombineChildren script.
This works well, and does what we’d like, but it removes lightmap functionality. Unless there’s a way to maintain the lightmaps, it’s not going to help us.
Combining objects manually in Maya
This works well and gives us very optimised draw calls, but it means that any edits we wish to make to the level occur outside of Unity. These changes then take a while to put through the pipeline and test in Unity again.
Dynamic batching
This sounds like what we want. Batching meshes with <300 verts. However, it doesn’t seem to be functioning? Is there a process that I may not be following? It’s interesting, because if I build a scene in Unity, it doesn’t batch, but if I pull in the meshes uncombined from Maya, they do batch. The scenes we’ve built in Maya have used a lot more assets than the test we’ve performed with Unity. Do we need to reach a certain threshold before Unity will start batching?
I’d normally be more thorough in explaining, but I’m looking for a quick response. If I’m not being clear enough just let me know, and I’ll provide screenshots and more in-depth descriptions of our problems.
You already answered them. The answer if you don’t have unity pro, is to batch them yourself in maya. Dynamic batching has real limits to how far it goes, and doesn’t work that well in cases like this. It would be great if its just tiny stuff like debris or mobile games.
Also, is there a list of Pro features somewhere? I thought I had what it offered well researched, but I’ve recently run into numerous issues I haven’t seen clearly listed.
Thanks for that link Da Awesome, I guess I’ll look at the Pro licenses at my college and see if I can find a working solution there.
If anybody has used Pro’s static batching, can you tell me what’s involved? Is it just marking the static objects (with the checkbox) and then at run-time it all just combines and works? Are the lightmap issues associated with the CombineChildren script still prevalent?
Edit: I’ve also found a sure-fire method of getting batches done dynamically, but it stops working if I utilise a shader that incorporates a bump map. Does this issue occur with the static batching offered by Unity Pro?
Static batching basically merges several smaller mashes (who share the same material) into one single mesh at compile time. It has to be used carefully too, as it significantly increases memory footprint/usage but saves CPU cycles because the meshes are merged at compile time and not at run-time (like dynamic batching)
Yes, you set it static. This can reduce your draw calls largely. You still want to consider combining your meshes - for good modular design, this should not get rid of light mapping options, keep in mind your light maps are going to be stored on uv’2 - and you will likely be atlasing/using optimized textures/shaders on your modular design.