In my voxel engine (XNA 4.0) I'm use a vertex buffer for the entire chunk and update it after the set block, changing block metadata or light level. This is not too frequent operation compared with the time of mesh rebuild. But now I want animate some blocks, for example, make door opening or lever switching smooth.

If I remember right, in Minecraft all draw on the fly using OpenGL (correct if wrong), but in my case this is not an option.

I'm know what is a bone animation and how it works, and I think that I can make something like this for animatable block X:

  1. rebuild chunk mesh without animated part of block X;
  2. create entity looking like removed animated part and animate it;
  3. remove entity and rebuild chunk mesh with that part in another static position.

I'm not shure this is a correct way. Any better ideas?

Also, how to make a block with animated textures? Do I need to use for this purpose a separate shader or I can somehow a correct texture coordinates of vertices in existed meshe?



1 Answer 1


It's a good idea to keep your static terrain in a single buffer. Updating it for small changes is totally reasonable. However for something like an animation I think you're going to need to diversify your terrain system. Objects like doors, levers, and other objects that need to be animated should not be drawn with the same buffer as the terrain buffer. You're going to have to re-update a lot of data that hasn't changed every frame of the animation.

I think it's more reasonable to keep these animated objects as separate objects in your scene that are disconnected from the terrain. When you load your terrain from a file when you come across a door that you should draw, don't store that door block as a piece of your terrain, keep it as a separate block that has distinct logic and its own model matrix.

Some animated objects like blocks of water or lava could actually just be "animated" by using a fancy shader effect. Likewise other lighting effects could actually be handled by a shader (research physically based shading and hardware lighting).


You must log in to answer this question.