I am having some difficulty conceptualising how a quadtree would be used to implement a spherical terrain system.

I currently have a spherical terrain system working, without any form of optimisation, I just have a vertex buffer full of every vertex in the terrain. Obviously, this can only be rendered at very low resolutions without lagging.

I intend to use a Chunked Level of Detail system to speed things up, however, despite my research, I am still somewhat unsure as to how to proceed.

From what I understand: I need to generate several levels of detail (by essentially creating several distinct terrain files, each with a lower resolution than the last).

I then load the quad tree with the data by setting each level of the quad tree to be a "level of detail", so level 1 would be the root node, encompassing everything, level 2 would contain very low resolution terrain data (in the form of a low-resolution list of terrain vertices), and so on until level n, where the highest resolution data would be stored (in the form of a high resolution list of terrain vertices).

This is the part I have the most trouble with, is this correct? Generating several terrain files at different resolutions, and loading each one to a separate level of the quad tree? Or should the tree be populated with vertices in a different way?

I then populate the main vertex buffer by searching the quadtree's nodes, and I use the players position to decide which nodes to return. So, the nodes far away from the player will be all high level (level 1) nodes with low detail, and as the distance to the player gets closer, the search will drill deeper and deeper into the quad tree, so eventually the nodes returned will be the highest detail level possible.

Is this in any way correct? My thinking on this is still quite hazy, even though I have done extensive research.

Thanks for any help or advice!

  • 1
    \$\begingroup\$ Topologically, a sphere is very different from a rectangle. You will need to use six quadtrees to do this effectively. \$\endgroup\$ – mklingen Apr 17 '15 at 23:38
  • \$\begingroup\$ Thanks for your reply. That's the way I created the sphere in the first place, by using six squares. I could easily create six quad trees as well. I'm still uncertain as to how to initialise the quadtrees though? \$\endgroup\$ – Ronan Collins Apr 18 '15 at 1:32
  • \$\begingroup\$ Which API are you using? Do you have access to the tessellation stages? \$\endgroup\$ – Jon Apr 20 '15 at 8:45
  • \$\begingroup\$ I am implementing this in the Torque Game Engine, but the code is largely my own. It's written in C++. I have access to all stages of the pipeline, but i'm not quite sure what you mean by "tessellation stages"? \$\endgroup\$ – Ronan Collins May 4 '15 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.