Jump to content
  • Advertisement
Sign in to follow this  
Colonel

Repeating 3D Terrain

This topic is 4070 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 am working on a 3D game with a basic square patch of terrain for the map. These maps will be designed to be tiled. I would like to set it up so that when a player moves off one side of the map the reappear on the the other side. My problem is when some one stands just inside the edge and looks out, how do I render the other side of the map? I could re-run the render loop with an offset world matrix, but that just seems inefficient. If you have ever played the multilayer Star Fox on the n64... Whats a *good* way to go about this?

Share this post


Link to post
Share on other sites
Advertisement
Well, you have to get the geometry on the screen somehow, so you'll have to do some sort of re-render. What you could do is only render a portion of each side so that there are no repeats in rendered geometry, if that increases your perception of the efficiency.

If there is some pixel shader that can do this in a single render, then pardon my noobness.

Share this post


Link to post
Share on other sites
Suppose the player is at some random point on your map. Imagine tiling your map so that theres tiles all around the current tile. Like this:

* - * - *
|...|...|
* - * - *
|...|...|
* - * - *

Each star is a tile, with the tile the player is in in the center. Each quad in the tile would be rendered 9 times then. One of those quads is closest to the player. Only draw that one (occlude the rest, or don't even send it to the hardware).

Repeat for all the quads in your map. Obviously you don't want to actually test every quad like this, but if you segment your map into zones, and test the zones, this should be really easy. Instead of throwing your geometry up as a single object, throw it up as, say, 100 objects or pieces. (Quad trees would work too, it depends on your needs).

Dynamically move the pieces as the player moves, determining where the object can be placed that is closest to the player. You'd only ever be drawing your map once; there wouldn't be any redundant rendering calls.

This would still cause oddities if your view distance is greater than your map length. Starfox had very thick fog for this sort of thing for this reason, among others, I think.

Share this post


Link to post
Share on other sites
wow... it is far too easy to overlook the simple solution thats staring you in the face.

Thanks for helping me put my head back on straight.

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!