I’m procedurally generating a hex grid (25x20) as a birds eye view. It’s generating a huge number of draw calls (5,000) because each terrain hex is stored as a separate mesh. Apparently Dynamic combining doesn’t combine very may vertices either. It works OK on a PC, but lags horribly on a Nexus 7 
My first thought (after the cursing and screaming had died down
was to reread the docs and try the CombineTextures script to merge the meshes. It works great (on small maps.) Unfortunately, once I try to scale, it hits the maximum number of Vertices for a mesh.
I want to scale this to more than 25x20.
Can I just procedurally create multiple gameobjects under the main map and put the new meshes/textures there (each onder 64K vertices) or is something else going to work better?
Thanks,
Ralph
Are you using Unity’s terrain engine or are you generating an actual mesh? Do you have a screenshot detailing your problem more? Also include any statistics data and if you can a profiler shot.
You should create many hexes in a single mesh instead.
–Eric
I’m basing it off of the 1.0 version of the hextech asset. I can do some things like remove the trees when zoomed out, replace rivers with Beziers, etc. which is going to help, but it is obvious to me that it isn’t going to scale the way I want without changes.
I absolutely could draw the hexes manually, I did that once already in OpenGL/Marmalade with triangle strips, so I have the math, but I’d rather leave the logic simple by creating the map from prefabs and procedurally combining the meshes instead of doing it by hand. I also like the way that this map does the hills, although they take a fair number of triangles. I will substitute much simpler meshes for the cases where there is no elevation change which will help.
Project it’s based on.
http://forum.unity3d.com/threads/102511-HexTech-Hexagon-Tile-Based-Map-Framework-available-on-Asset-Store
My display.
After CombineChildren on a 3x5 map. Drawcalls drops to 16, I can drop that down further by doing an atlas but that’s going to make the mesh size bigger and cause more issues there :(. I’m not freeing the unused triangles and meshes(yet), that’s why the tris and verts is so high. I’m not as worried about them.
I’m using the Free version so I don’t have access to the profiler.
Thanks for looking at it.
Wtthout calling CombineChildren, that little 3x5 map has an insane 142 draw calls, so combining definitely does help with this.
That’s nuts. How many materials are being used here?
So every object generates at least 12 drawcalls? (one for every material AT LEAST) Why so many materials on every instance?
I’m looking into why that’s happening, my understanding of Unity is that even if I fix that, it’s still going to want one draw call per material per hex unless I combine them.
Hmm… Hold on a second… Are the UV’s and/or materials set by scripts?
In some cases this will break CombineChildren but certainly also batching options!
In my MazeGenerator luckily changing material through script doesn’t break batching, but i know adjusting UV’s very oftenly does.