Preview for the problem:

I'm making a similar game to Minecraft (a game that it's world is made by cubes), but the fps of the game is getting low only by rendering a little amount of cubes in the world.

So I decided to use the Combine/Margin technique to improve it. I want to combine cubes that are from the same type and there positions are next to each other.

Lets say I have 4 faces of cubes that are next to each other in that order:

[+] [+]

[+] [+]

Right Now: I am rendering each face with 2 triangles so in total I render all of the faces with 8 triangles.

Improvment That I Want To Make: I want to render these faces with only 2 triangles but to keep the textures where they are at. Which means to use only 2 tringles for 4 faces and to use 4 textures in that area.


Currently I'm using:

  • Frustum culling.
  • Not rendering cube faces that are on each other.

Which fps improvment techniques do you recommend me to use? Currently when I'm rendering only 1500 faces at the same time [3000 triangles] my game is getting to about 25~ fps.


1 Answer 1


It's not possible sadly to have multiple textures without also dividing it using vertices. However, improvements can be made.

Don't divide the cubes into faces, the overhead of this approach outweighs the performance gain. Instead use indexed rendering and draw every visible cube at once. A cube is visible if one of the 6 neighbours is transparent. The faces you'd save using the divide approach will usually get backface culled (turn that on if it isn't).

Draw everything starting from the player's position to allow z-culling to cut even more fragments.

Another performance optimization used by minecraft is to divide the world into 16x16x16 chunks and use a fill algorithm to check whether sorrounding chunks are completely occluded or not.

If you want to go even further, only send points to the GPU and generate the cubes using a geometry shader. This can combine the pros of every technique, including leaving occluded faces out.

  • \$\begingroup\$ "It's not possible sadly to have multiple textures without also dividing it using vertices." I can think of a few ways to accomplish this. Since OP describes combining cubes of the same type, I think they mean they want four repeats of the same texture across that area. That's entirely doable with either array textures or performing texture wrapping in the shader. \$\endgroup\$
    – DMGregory
    Jan 18, 2019 at 11:55
  • \$\begingroup\$ @DMGregory It could, but the only real reason to do so is to have fewer drawcalls, and indexed rendering does that better in this case. \$\endgroup\$
    – Bálint
    Jan 18, 2019 at 12:12
  • \$\begingroup\$ The main reason would be reducing vertex/triangle counts. You could take a 16x16 flat ground plane of "grass" blocks in one chunk and take it from 512 triangles to 2, from 289 instanced vertices to 4. Over a large voxel world, reducing your vertices & triangles by these kinds of factors adds up to significant savings. And it's not incompatible with reducing draw calls - just combine these visible surfaces of a chunk into a single mesh and draw it in one call. \$\endgroup\$
    – DMGregory
    Jan 18, 2019 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .