Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

i'm currently developing my first 3D game for a school project, the game world is completely inspired by minecraft (world completely made out of cubes). I'm currently seeking to improve the performance trying to implement vertex buffer objects but i'm stuck, i already have this methods implemented: Frustum culling, only drawing exposed faces and distance culling but i have the following doubts:

  1. I currently have about 2^24 cubes in my world, divided in 1024 chunks of 16*16*64 cubes, right now i'm doing immediate mode rendering, which works well with frustum culling, if i implement one VBO per chunk, do i have to update that VBO each time i move the camera (to update the frustum)? is there a performance hit with this?

  2. Can i dynamically change the size of each VBO? of do i have to make each one the biggest possible size (the chunk completely filled with objects)?.

  3. Would i have to keep each visited chunk in memory or could i efficiently remove that VBO and recreated it when needed?.

share|improve this question
    
You can have a look at my project called CraftMania. All sources are open source. Here is the GitHub page: github.com/mcourteaux/CraftMania –  Martijn Courteaux May 17 '12 at 13:59
add comment

1 Answer 1

up vote 0 down vote accepted
  1. Do you currently modify your cubes on the CPU in order to do frustum culling? When you move the camera? If not (and I'm guessing not), then there's no need to do it for the GPU as well. If so... then you should probably stop doing that.

    Unless the positions within a given mesh are actually moving relative to one another, they should not be changing. They should be static. You should be transforming those cube chunks into different positions using matrices through OpenGL. The vertex positions you pass, whether in immediate mode or with buffer objects, should not be changing.

    Frustum culling should not be done against the actual cubes, but against the bounding volume of each chunk. That's what you should transform to do frustum culling.

  2. Yes you can, but I would strongly advise against it. See below.

  3. You can do whatever you want. But you shouldn't be deleting the actual buffer objects. Instead, you should be swapping data into and out of them. Allocate however much active buffer space you need initially, then upload different data into them as needed. More information on streaming to buffer objects exists.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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