0
\$\begingroup\$

So Im trying to make a minecraft style voxel game to learn OpenGL, but Im running into performance issues. I found this thread : https://stackoverflow.com/questions/4995652/3d-occlusion-culling where the author says he's drawing 250,000 cubes with an okay framerate. However, I can do about 3000 ish with the same framerates. I found another thread in which someone said that you should combine visible faces into a mesh. Does that mean you put all the vertices into one vertex buffer? If so, how do I pass texture data?

\$\endgroup\$
3
  • \$\begingroup\$ Welcome user, this is a very broad question, too broad for the site. You need to use a profiler and find out which parts of your code are slow. Try to improve those parts, if you're unable to, then come back here with a specific question about that part of your game. Make sure to include what you tried and why it didn't work. \$\endgroup\$
    – MichaelHouse
    Jul 6 '13 at 18:38
  • 1
    \$\begingroup\$ @Byte56 I think the question is OK now, even answerable. -> Yeah, you should try to use as many batches as possible, that is, combining the more cubes you can, in the less vertex buffers you can. This is a good resource on the matter: 0fps.wordpress.com/2012/06/30/meshing-in-a-minecraft-game And to use more than one texture, you can use a texture atlas, or even multi-texturing, though atlas will give you the best performance! \$\endgroup\$ Jul 6 '13 at 22:28
  • \$\begingroup\$ @GustavoMaciel All yours. \$\endgroup\$
    – MichaelHouse
    Jul 6 '13 at 23:15
3
\$\begingroup\$

Yeah, you should try to batch as much as possible, that is, combining the more cubes you can, in the least amount of vertex buffers you can. This is a good resource on the matter of Voxel Meshing. I recomend you to follow the culling algorithm, even older versions of minecraft used it and stood well at good framerates.

To use more than one texture, you can use a texture atlas to fake that. Some devices might even support multi-texturing in a single batch, which would be easier to work with, though the atlas will give you the best performance!

\$\endgroup\$
4
  • \$\begingroup\$ So I already use the culling method where you check all sides, but the frame rate is still pretty bad \$\endgroup\$ Jul 7 '13 at 12:32
  • \$\begingroup\$ But you are saving the whole mesh in a single batch? If you render the cubes separately, the framerate will be very low. \$\endgroup\$ Jul 7 '13 at 15:23
  • \$\begingroup\$ i guess im missing what a mesh is...but when you dynamically combine a mesh, how do you draw the different textures? \$\endgroup\$ Jul 7 '13 at 20:10
  • \$\begingroup\$ Read the last paragraph. \$\endgroup\$ Jul 8 '13 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.