Jump to content
  • Advertisement
Sign in to follow this  
Raeldor

Dynamic Terrains and Vertex Buffers

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a terrain which is comprised of tiles. When the tile gets built it is tessellated based on the distance from the camera using a binary triangle tree, which means when I come to making the vertex buffer I never really know how many vertices there will be. Sure I could traverse it once to get the vertex count and another time to fill the buffer, but then I am doing twice the work (that's the way it works now). There could potentially be a large number of vertices, but then there could also be a very small number, so I don't want to allocate a large buffer and waste memory. What is the best way to handle this situation? Should I use a vector array and then copy it in a loop into the vertex buffer? Is there a more efficient way? Thank you! I am using Direct3D BTW.

Share this post


Link to post
Share on other sites
Advertisement
Hmmm... I would probably advice you to go for a much more GPU-friendly algorithm.

I use Geomipmapping and what I do, is to:

Split my terrain into patches (e.g. 16x16 patches).
For each patch create a VBO with the patch vertices AND vertices for skirts.
Create one Index-buffer for each LOD.

Then when I update my terrain, I create a list for each LOD with the patches that belongs to that given LOD.

When I render my terrain, I traverse the list, set the LOD-Indexbuffer and render the VBO from the patch.

By including skirts for each patch with no subject to it's neighbours LOD, I get a VERY efficient terrain-renderer, which almost dosen't use the CPU at all!

To further optimize it, you could store only the heights for each patch and then move them using a vertex-shader... This way your memory-use is 1/3 of the usual!

Best regards,
Roquqkie

[Edited by - Roquqkie on June 17, 2005 6:01:03 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!