I have built my own LOD terrain system. As the camera passes through terrain segments, I remove the hardwareBuffers that need to be changed and create new ones with the updated data. So essentially I I push indices,vertices,normals and UVs regularly as required depending on the position of the camera. This a bit slow building the segments and buffers but it works... However looking at this post ..
http://stackoverflow.com/questions/4424 ... with-depth
It suggests that I should not do it like this.
I tried pushing all the vertices at once but I have two issues with this for large terrain (8192x8192).you should not try fiddling around with buffer up-/downloads. Just upload the vertex data one time and then just adjust the index arrays and the order in which those are submitted.
- I run out of memory and my application is killed by the OS
- The max number of vertices is 256^2 , so you need to create a new hardware buffer for each segment, this is essentially a new render object, which for 8192x8192 means 32^2 which is really bad performance
In the original way I was doing it, I batch the segments together. Since most segments are low LOD I can fit many of them into a single hardwareBuffer.
Any thoughts on this? If you have some experience or suggestions I'd really appreciate your feedback!
Thanks!
edit: btw I'm using Ogre::HardwareBuffer::HBU_DYNAMIC and Ogre::HardwareBuffer::HBL_DISCARD for both vertices and indices.