Jump to content
  • Advertisement
Sign in to follow this  
george7378

3D Adapting planar quadtree for spheres

This topic is 393 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

Adapting planar quadtree for sphere

 

Hi everyone,

 

I'm quite used to working with quadtrees for flat, 'infinite' terrain where I just have a coherent noise function that returns a height for a given x, z position and quadtree cells are split based on camera distance to their centre (where the centre takes into account the height as well).

 

I'd like to expand this to work for spherical planets using the common method of having 6 quadtrees which form a cube, then normalising the vertex positions to make a sphere. I have a few questions though which none of the tutorials for this seem to answer:

 

  1. What coordinates should I use to sample my noise function? The raw (x, y, z) coordinates of the vertex positions in the cube, or should I use the same coordinates but after I've 'spherified' them?
  2. What distance should I use to decide if quadtree nodes should split/merge? Should I use distance from camera of the node in its cube position, or should I work out where the node's centre is on the sphere and then use the distance to that?

 

Thanks for the help :)

Share this post


Link to post
Share on other sites
Advertisement

1. Make your noise function 3D and use coords from sphere surface (easier / nicer than trying to make corners and edges seamless).

2. Use sphere positions, otherwise the error becomes large if you are close to the surface.

Share this post


Link to post
Share on other sites

Thanks for the reply - makes sense! For the second point, I guess that means a given LOD in the quadtree will have a slightly differing vertex density across the sphere due to the deformation when the tiles are projected onto the sphere? I suppose it's a minor problem though.

Share this post


Link to post
Share on other sites
32 minutes ago, george7378 said:

Thanks for the reply - makes sense! For the second point, I guess that means a given LOD in the quadtree will have a slightly differing vertex density across the sphere due to the deformation when the tiles are projected onto the sphere? I suppose it's a minor problem though.

I am not sure what you mean what i think, but if you map a tesselated cube to a sphere the result is never uniform.

You can improve some things at the cost of others, e.g. you can make sure all quads on the sphere end up having equal area, which sounds nice, but comes at the cost of more distortion at the edge angles of the resulting quads. Normalizing the tesselated cube vertices is simple and a good compromise of anything - i always came back to that after messing with more complex mapping approaches.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!