@kaedroho
I'm going to be adding terrains to mine and dark coder's game engine in the near future (pure C++
), and I really like all the new features you have thought of, such as quad rotation.
When you are working out which way to place the diagonal, how exactly do you do it?
From the four vertices alone it's not possible. (Consider the case when two opposite vertices are high, and the other two are low. It could be a peak running one way, or a valley running the other way)
I also thought of a new idea. Instead of dividing the terrain up into a few large sectors, dividing it up into many very small sectors would be very useful. (Each one would be the size of a quad at the lowest LOD level)
- For each sector at creation time, you could generate an importance value, based on how angular the sector is. This importance value would weight the LOD range, so more angular sectors would need to be much further away to go down LOD levels, whereas very flat sectors would be go down LOD levels very easily.
- Exclusion mapping would be in terms of sectors instead of individual quads, making it much easier to match up seams.
- Each sector's LOD levels would be precomputed in memory, so that changing the terrain just requires a few raw memory blits to the vertex and index buffers, and then an alteration of the vertex and index count.
- Sectors determined to be facing away from the player can be omitted before sending the data to the graphics card, whereas normally all the faces have to be sent, and then the card itself removes backfaces.
- I can use a 32-bit index buffer, so that I don't need to separate the data over multiple draw calls. (The sectors will already be culled, so there is no point separating them)
- I can create an octree to encompass the terrain making culling of individual sectors very fast.
- Real-time terrain editing would only require altering the data in memory, because at the next update it would automatically be copied to the vertex and index buffers if it is needed.
- LOD is more effective when used on smaller sectors.