Title says it all.
What's efficient way to draw a lot of textured cubes in XNA4?
Title says it all.
What's efficient way to draw a lot of textured cubes in XNA4?
I guess it is for another minecraft-inspired game, so "a lot" means several million cubes :) Well, be it minecraft, warcraft, XNA, OGL or whatever else, the task of drawing "a lot of anything" consists of two parts:
It's possible to write an entire book about these problem facets, so let's keep it simple.
How to reduce the amount of the cubes you need to worry about? Use octrees and perform frustum culling for visibility determination.
How to optimize the draw method for lots of cubes? Large number of cubes (maybe even all of them depending on your approach) will share the same material, so it will be easy to utilize instancing.
Then again, depending on how much "a lot" actually is, you may want to stop caring about rendering optimizations at all. With the modern hardware you can draw like ten million of textured cubes easily with almost no hassle: just divide them into large chunks and draw with basic batching and a simple index buffer.
Have a look at this SunBurn instancing example: http://indiefreaks.com/2011/01/27/hardware-instancing-with-igf-sunburn-rd-part-1/ and then part 2 http://indiefreaks.com/2011/01/28/hardware-instancing-with-igf-sunburn-rd-part-2/ It handles massive amounts of instanced objects.