Most efficient method to render a bunch of cubes?

Started by
2 comments, last by coder13 12 years ago
Hello, I have been troubled by this for quite a bit. I understand some basics to rendering a cube. So I would just put it in a class, then come render time, just translate it depending on its location. I was wondering if this is the most efficient way to to render a bunch of cubes?
Advertisement
No, it's not the best way. In fact, that will be extremely slow. You want to reduce your total number of draw calls. Drawing each cube individually results in a LOT of draw calls. You want to cull the non-visible cubes so that they are not drawn at all, cull the non-visible faces, and batch up the visible faces into as few draw calls as you can manage. You might want to check out this series of articles by a guy named Michael Goodfellow, written as he worked his way through this same thing.
Hello coder
Maybe could you be interested by geometry instancing ?
This way, you provide the mesh of the cube (only once) and the world matrices of all the instances (and eventually other data you need for rendering each instance).
With this technique all the cube instances would be rendered within a single draw call.

Sorry I can't be more specific, I only use DirectX10 unsure.png , but I'm sure you'll find easily some documentation on OpenGL instancing wink.png
Bye
Thank you for your replies. I will look into them.

This topic is closed to new replies.

Advertisement