- Home /
How Can I Load Massive Terrains In Sections?
I have a fps style scene in which I have made about 20 relatively small terrains and want to load them only once my player gets close to them and then become hidden when he has left the area. The terrains are being used with normal mapped textures and details (normal mapped grasses) and are stitched together using Stitchscape. I am also using Prefab'd trees with capsule colliders on top of but separate from the Terrain which I hope umbra Occlusion Culling will be able to handle since I'm making them static?
I am guessing I could use a collider placed far in the front and rear of my Player which will trigger something like render.enable = true;(or false) when it touches another Box Collider which I will place over each terrain tile?
I am obviously very new to C# and JS but I do know Python so some examples of solutions would be awesome!
You can look at SetNeighbors for some LOD info on Terrains; do you need anything special here, or can you just let your Camera Far clipping plane do this for you automatically?
I need the terrains to become completely invisible as if they were removed from the game. SetNeighbors cannot do this correct? $$anonymous$$y reasoning for needing this is I ultimately want to expand the map to something like 30 sq km and loading the whole map terrain at start is to costly. If I am wrong about this please someone tell me how, as I have only experimented with unity terrains for about a week now.
You would need some sort of system to deter$$anonymous$$e which tile/nearby tiles to load based on players position one way to do this is to use modulo
TileIndexX = (transform.position.x - (transform.position.x % TileWidth)) / TileWidth;
Then do the same for Z Then you would have a system for loading tiles based on their index, I can't help you much further without more information about your game. However, it all depends on if you want procedural generation, if you want to expand the system in the future and so forth, based on these things I would know if it's possible to make the system easy to use and not a hassle when adding new terrains.
No real plan to use any procedural generation in the future, particularly for the terrain.
I guess I could give you something I wrote down quick some time ago, it bases on the same concept, using Coroutines and Resources.Load would allow you to perform the tile loading in the background, the idea here is to load tiles that aren't really visible to the player before they become visible and also keeping them loaded until the player is way out of range, I haven't put it much to test yet myself anyway. (keep in $$anonymous$$d this is just some quickly scribbled notes and not based on a lot of facts)
Your answer
Follow this Question
Related Questions
Colliding with Terrain and Destroying it 1 Answer
GameObject going into terrain. 0 Answers
Late Rocket Explosion 1 Answer
Can't click gameobject when over another trigger? 1 Answer
Player sometimes, only occasionally falls through terrain 2 Answers