• ### What is your GameDev Story?

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

## Recommended Posts

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 on other sites

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 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 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 10
• 9
• 35
• 16
• ### Forum Statistics

• Total Topics
634125
• Total Posts
3015677
×