- Home /
Endless Terrain "Loop"
Hello, I am curious to how to achieve a endless terrain, A terrain that loops back on itself making it infinity, I would never see the edge and would always stay on the terrain no matter how far i go, I used my A+ artistic skills to demonstrate what i mean,
P.S. Imagine the HD Square as a terrain, High polly arrows are player 1 and player 2.
So my questions are, Is this possible in unity's engine? if so what would be the easiest way to achieve such a thing?
Thanks.
Part of your solution might involve Terrain.SetNeighbors and possibly Terrain.Flush, check those out. Another possibility is a large sphere 'world' that's not terrain, but a GameObject
I did proceed to make a sphere terrain, It worked fine except in order for the terrain to seem flat the sphere "world" would need to be huge.
Don't ask me how this can be done (I want to know myself). But it is definitely possible. This game is the proof.
I think there's a problem in the concept though - in the top pic, blue player looking left isn't seeing into infinity in the way it's usually considered via "flat" terrains (ala $$anonymous$$Craft), it's a closed loop (thus he can see red).
Answer by TropicalTrevor · Jan 28, 2014 at 02:39 AM
EDIT: Without pictuers I also thought you meant infite terrain but your pictures say you want 'wrapping' terrain. So edited my awnser for wrapping, check the first version for ideas on 'infinite' in which a terrain is indeed infinite and you will never leave it, but you won't see what's on the other side as in some kind of paradox.
There are various issues that you'll have to deal with... and various way to achieve solutions.
Tiling terrain You could create a tileable terrain, generated from a heightmap which was made tilable outside of unity. Then all you'd need is 9 terrains with the same heightmap.
The camera clipping (and possibly fog) should make sure you can only see as far as one terrain is wide. This way you can walk all across the center terrain you will never see edges and the world is already tiling. Whenver you leave the center tile and enter an adjacent terrain tile, you can move the terrains that are too far away and put them in places that are now closer. Because they all tile this would make your world seem infinite.
Wrapping objects In update simply module the position and reassign position = new Vector3(position.x % 10, position.y % 10, position.z % 10);
Then make sure you have 9 versions of each object offset by the same units as that you wrap it by (in this case 10).
Problem with the idea is however that the player wraps in 2 axes, so it will appear that the same player has surrounded you from all sides.
You'll see it where it really is, but also behind you, and reflected because it wraps in X as well as Y.
Hello and thank you for your answer, I have managed to wrap terrain's, But the problem now is i cannot see Player 2 once they reach the edge and are put to new vector, I am not so good as explaining myself so here is a quick web demo to show what i mean,
Now the wrapping is perfect as you will see, Used fog so you wouldn't see the center object on all sides as you stated above,
Notice how when you get close to the statue the red players disappear, as you progress further they will reappear again.
Any way to keep them visible?
Cameras with custom shaders? or Stencil buffers maybe?
Thanks.
Your answer
Follow this Question
Related Questions
how to generate custom procedural terrain ? 0 Answers
Rivers on procedurally terrain 0 Answers
Procedural heightmap shader - Normals and tangents 0 Answers
Vector math problem 2 Answers
how do i procedurally generated perlin noise infinitely c# 0 Answers