How can I make extremely huge terrains in Unity? It seems like I can set width and length to large values. But the Heightmap resolution only goes up to 4097 and the Detail resolution only goes up to 4048.

Any ideas?


5 Answers 5


Split the terrain into square "chunks", load those you care about (mostly: Those near the currently active camera) in Update() and - if you are strapped for space (you likely will be), unload the not needed ones far away.

Use pre-calculated low-poly models for far-away terrain LoD, unless you don't mind having a low view distance. Also, if you need the terrain heightmap of far away terrain for anything (like NPC movement or some other simulation), create a low-resolution or variable resolution variant of your terrain to keep in memory; don't use the full terrain data for it. This can be done automatically on game load, but generally it's a better idea to make a tool which creates this pre-generated data during the build or package.

Finally: To avoid floating point precision problems, you'll have to reposition the whole scene every time your main camera moves far away from (0.0f, 0.0f, 0.0f).

Possibly relevant question on Unity Answers http://answers.unity3d.com/questions/17225/dynamic-terrain-loading.html

  • \$\begingroup\$ Thank you! great answer. Just one question, when I set the neighbors of the terrains, what would happen if the terrains aren't at the same height on the edges? \$\endgroup\$
    – Daniel
    Aug 6, 2011 at 19:03
  • 2
    \$\begingroup\$ @Dan: You'll get holes in the landscape. There are different ways of dealing with this, roughly along the lines of "make sure the landscape has same height at the edges", "add skirts running vertically from the edges down for some height to mask the holes" and "add generated triangle strips to stitch the holes together." Which one you use is up to you (and the engine, in part). The second one, with the skirts, is the one I saw most often. \$\endgroup\$ Aug 6, 2011 at 22:05
  • 1
    \$\begingroup\$ or as I said, you'd like to use a script to seam the terrains :-) \$\endgroup\$
    – Valmond
    Aug 6, 2011 at 22:54
  • \$\begingroup\$ Does anybody have any scripts? \$\endgroup\$
    – Daniel
    Aug 7, 2011 at 18:09
  • \$\begingroup\$ @Dan: There are some scripts at the Unity Answers link in the answer. Besides that, I can't help you with code for Unity at the moment, all my (hobby-level) game programming is done with Ogre3D as the rendering engine. \$\endgroup\$ Aug 7, 2011 at 19:33

You'll need to break up the terrains in chunks, ie. several smaller terrains. Yo'll need to 'seam' those agains eachother (with a script) so there won't be 'holes' between them but otherwise you can just start doing them right away.

You might want to know too that since Unity3D ~3.0 you can't move items (read terrains and items) too far away (like +/-100000 steps IIRC) so this will influence the maximum size of your world.

I'm using this in my online RPG game anyway (with the exception that I only use Unity3D for level design, not for the actual game).

Just because I'm curious, would you like to share some info about your game (like advancement, type, graphics, style etc.)?


We did implement huge terrains in Unity5 by processing SRTM data for the whole earth into height-maps for TerrainData objects with different Levels of Details[1]. There are a couple of things to consider:

  1. The very edges of the height maps need to overlap by at least one sample and you need to position your terrains accordingly. Terrain.SetNeighbors will not connect the mesh, only account for different levels of detail done by Unity.

  2. You, necessarily, need 2^n + 1 height samples per TerrainData object, otherwise Unity will just assign a height of 0 to the unset parts.

  3. If you have less than 2GB of TerrainData, you can get away with having them as Assets in a Resource folder and Resource.Load them at runtime. If you have more than 2GB this approach will no longer work as there cannot be more then 2GB of resources with Unity builds. In this case you will need to build AssetBundles and asynchronously load them with the WWW object. This has the unwelcomed side-effect of calling Shader.Parse for each with an overhead of approximately 500ms. I did report this on the forums[2] and are still waiting for a reply. I will submit a bug report eventually.

  4. Don't think about using AssetDatabase.LoadAssetAtPath, it is only available in the editor and not in Unity builds.

[1] https://www.youtube.com/watch?v=2UsyVuWoFbQ
[2] http://forum.unity3d.com/threads/shader-parse-delays-loading-of-assetbundle-containing-no-shader.358235/


There are third party solutions.

this code can make terrains of 99,999 meters width, the mountains are any noise formulas, but you can mix 100 noise formulas into one map if you want. for example, in this terrain, the total number of triangles available in a map is between 66million, low resolution, and 200million medium resolution. here is a 66million triangle map, where 0.7mn triangles are updated around the camera. unityplayer giant terrain, WASD and Space

  • \$\begingroup\$ Is there source code for that? All I see is a unity plugin game. \$\endgroup\$ Sep 9, 2014 at 17:16
  • \$\begingroup\$ i have the source code, it took me a while to write. i'm at ant d0t stewart at yahoo d0t com \$\endgroup\$ Sep 11, 2014 at 11:00

I would recommend loading your terrain in chunks. By using smaller terrains, and perhaps your script could check if you are in a certain proximity to your terrain by using transform.position - terrain.transform.position. I actually wrote a blog post on how to optimize your game as a whole, and I talked about chunk loading. Hope this helps.

  • \$\begingroup\$ Note that this advice is already present in the accepted answer from Martin Sojka from 6 years ago. If you'd just like to share a relevant link, a comment on that answer might be more appropriate. \$\endgroup\$
    – DMGregory
    Oct 31, 2017 at 12:36
  • \$\begingroup\$ In the future I will. Thank you. I'm still new to posting on stack exchange :) \$\endgroup\$
    – Hudson
    Nov 1, 2017 at 16:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .