Advertisement Jump to content
Sign in to follow this  

Creating looping terrain

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

Hey, Ok, so I've created a quadtree and have split up my terrain into chunks which are each then assigned to a unique leaf node in the quadtree. Each chunk is simply a unique set of indices that operate on the same full set of vertices. Now, I want to make the terrain "looping," so that if the player moves off the edge of the terrain, he will pop back to the other side. I can change his position accordingly, this is no problem. However, as the player approaches the edge of the terrain, they see the 'edge of the world' right up until they are popped back to the other side -- not a very convincing illusion. So, I need some way to detect that the viewing frustum is viewing off past the edge of the terrain, and render the appropriate amount of nodes from the other side of the terrain to fill it up. Maybe these pictures will clarify a little: In the image to the left, you can see that as the player approaches the left side of the terrain, most of his viewing frustum is seeing nothing -- the player sees the edge of the world. In the image to the right, nodes 3 and 4 are drawn again infront of the player to give the illusion of looping terrain. Once the player hits the edge of the "actual" nodes, they will seamlessly pop back to the other side. So, my problem: I'm unsure of a clean algorithm to do this, or if this is even the best way... Has anyone ever attempted something like this? Is there a good way to organize my quadtree-scene graph to set something like this up?

Share this post

Link to post
Share on other sites
What you need to have is your spatial structure displaying 8 fields around the field the player is in. So, an example would be:

P - Player location field

1 2 3
4 P 5
6 7 8

So, you require to have in cache the 8 fields that surround the player. At least. If your fields are small so that you can see end of the world after the fog, then you need to increase that by another 'circle'.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!