I’m currently building for latest devices, but a broad answer is very welcome.
As an example say I have the below wall built out of loads of little cubes:
If I was to build this wall with cubes, it would not be the best route due to inside unused faces and they’d all need a texture (say 3 different textures for variety).
However, if I was to build this wall as one mesh with a 3d modelling tool, would that be more costly in game? I mean uv mapping would be larger on this object. Though, it would also contain less verts, and ploys. I don’t know what would be cheaper then.
I’m either going to model the entire wall as background geometry, 1 mesh with 1 texture., or I will create 3 maybe 4 different building blocks and build it that way but then they’d have 3 or 4 textures.
I’m concerned about draw calls, as well as vert and poly count, understandably. I’m also unsure on what the best practice is for texture sizes for iOS.
Suggestions welcome,
Thanks, NoviceBobble.
2 Answers
2
I’ve had luck going with the building block method rather than creating the whole level as a single mesh. In my case, having 18k vertices and 200 draw calls has performed well even on the iPhone 4.
To optimize things…
If you know your building blocks will be seen from one side only then you don’t need to have a complete cube. Model only the sides which will be seen, then place them into your scene and rotate your object for corners. In other words, instead of a cube, use a plane for your walls and as you add more planes rotate them as needed. This way you’ll only have vertices for visible objects and avoid unnecessary geometry.
Combine as much as you can into a single texture. I’ve been using 2048px texture maps where multiple objects can use the same texture.
Avoid lights and bake everything once your scene is set-up. Use unlit shaders that support lightmapping.
What helped me out a great deal in understanding level building was downloading the MadFinger example from ShadowGun. Take a look at how they built their level… it should give you further insight.
http://blogs.unity3d.com/2012/03/23/shadowgun-optimizing-for-mobile-sample-level/
It sounds like you're looking at a minecraft clone of sorts. Theres quite a lot of answers around for that sort of thing. You basically want to make your own mesh and atlas for each 100x100 (or so) section of land. If you're doing cubes I think you'd probably be better doing the generation in code. If you're not looking for the challenge, there's stuff on Asset Store that does it.
– TarliusNope not a mine craft clone, just using cubes. I ask as I am conscious of say 2000 cubes killing the frame rate etc and am looking for advice. I think a texture atlas is a good direction though, thank you
– BobbleHeadWhilst the gameplay may be different, the problem sounds the same. Although perhaps you won't need to rebuild your mesh often like minecraft. As for 1000s of cubes; theres a hard limit on how many game object you can have in a scene apparently (a minecrafter ran into the problem a few weeks back). If they all share the same texture, they should get batched though.
– Tarliusyou can allways change the clipping distance of the camera, and add fog might help with FPS
– BLOODLORD