Search Unity

We now have a team dedicated to terrain, and our initial efforts will soon be publicly available! Unity 2018.3 will ship with an update to the terrain system. This update features improved tools and performance by taking better advantage of the GPU. It also adds support for the HD and LW render pipelines, while being backward compatible with the built-in render pipeline and the existing Unity Terrain system.

Get the Unity 2018.3 beta now to get early access to the updates! Please be aware that the user interface and the API are both still subject to change as the beta is still under active development.

Performance

On the performance side, we added a GPU-instanced render path for terrain. In most cases, instancing yields a dramatic reduction in the number of draw calls issued. Many of our tests saw more than a 50% reduction in CPU costs (though, of course, actual numbers will depend on your platform and use case).  You can choose this new render path by enabling ‘Draw Instanced’ in the Terrain settings:

When enabled, Unity transforms all of the heavy terrain data, like height maps and splat maps, into textures on the GPU. Instead of constructing a custom mesh for each terrain patch on the CPU, we can use GPU instancing to replicate a single mesh and sample the height map texture to produce the correct geometry. This reduces the terrain CPU workload by orders of magnitude, as a few instanced draw calls replace potentially thousands of custom mesh draws.

As a nice side effect, it also improves our load times! Not only can we skip building all of those custom meshes, but we can also use the GPU to build the basemap (pre-blended LOD texture); the GPU is much faster at that kind of thing.  This also means that if you have your own custom terrain shader, you can now override the ‘build basemap’ shader and generate matching basemap LOD textures.

Terrain Visuals

Instancing also improves the appearance of terrain normals; we decouple the terrain mesh normals from the geometry by storing them in a normal map texture that is generated from the heightmap and sampled in the pixel shader. This means the normals are independent of the mesh LOD level. Consequently, you can increase the ‘pixel error rate’ to decrease vertex cost, with fewer artifacts.

Old per-vertex normals (left) and new per-pixel normals (right) — with identical triangle counts.

We also developed terrain shaders for both the HD and LW render pipelines, available in package versions 4.0.0 or later, with support for instanced rendering and per-pixel normals.  The HD shader was further enhanced to support new features such as height and density blend modes, normal scaling, texture controlled surface metalness and smoothness. The HD terrain shader is limited to a single pass, but it does support blending up to 8 terrain layers in one pass.

Scriptable GPU Tools

On the editor side, we have exposed a script API for building your own custom terrain tools, along with a suite of utility functions you can use to easily implement seamless cross-tile sculpting and painting operations on the GPU.  The new TerrainAPI includes TerrainPaintTool<T0>, a base class for terrain tools, and TerrainPaintUtility, containing utility functions for modifying terrain data.

Applying these changes, we converted all of the existing terrain tools to GPU operations. Aside from making these tools much faster, this also gave us larger brush sizes, improved brush previews, and the ability to paint across terrain tile borders with automatic seam-stitching.

New stamp terrain tool, with live preview, coming to 2018.3b 6.

We’ve also begun experimenting with brush features such as brush rotation and randomization and more advanced painting tools, like heightmap and mesh stamping, clone brushes, and more. These painting tools features are currently not in 2018.3, but we are making them available via our GitHub Terrain Tools project.

Multiple Terrain Support

We made it easier to work with multiple terrain tiles. Aside from seamless painting between terrains, you can now manage the connections between neighboring terrains automatically. Previously, this required writing a script to connect neighbors manually.

Enable ‘Auto connect’ in the Terrain Settings, and the Terrain will automatically connect to its neighbors with the same grouping ID.

When expanding your existing terrain, you can use our new ‘Create Neighbor Terrain’ tool to quickly add matching terrain tiles along empty borders.

We are also working to make resizing and resolution changes less destructive. In 2018.3, the heightmap and splat maps will resample when you change their resolution, instead of the previous behavior of clearing the data and losing all of your work. We are working towards improving all resizing operations in the near future.

New Asset Types

In order to simplify workflows, we also created two new terrain-related asset types: the TerrainLayer asset and the Brush asset.

TerrainLayer lets us define terrain materials independent of the terrain object so that we can easily track the same material across multiple terrains. This helps with seamless painting and material modification. We also extend the TerrainLayer asset to support “mask map” textures, which can be used for arbitrary shading purposes, and a script interface to provide shader-dependent custom GUI for the TerrainLayer asset.
The Brush represents the GPU brush shapes used by painting and sculpting tools. They are now defined by a texture and a radial falloff curve. This makes it much easier to create and tweak brush shapes (which previously required dropping arcanely crafted image files into a specially named folder).

We also added support for the R16 texture format (a single channel 16-bit format) to Unity. This allows us to avoid 8-bit quantization on our brush shapes, which can cause undesirable ‘terracing’ effects if used as a heightmap stamp.

8-bit brush stamp showing ‘terracing’ artifacts (top) and 16-bit brush stamp (bottom).

Our terrain team is just getting started and development continues. Please send us feedback in the World Building forum!

Комментарии закрыты.

  1. Excellent !
    Thankful

  2. Shame that grass and detail meshes do not work on HDRP, makes for very bland terrain currently :/

  3. Hello,

    Do you add something to get the world position and rotation of Detail mesh on the terrain. I Really need this feature and i didn’t find it in actual terrain tool. If it’s already possible to do that can you explain me how ? Thanks a lot

  4. VERY happy to see the Terrain engine get some love. Thank you. One suggestion: can you separate the splatmap from the Terrain.asset file? It would be very helpful to be able to export and import them as PNG or TIF or equivalent.

  5. 牛逼!unity~

  6. any chance that you can work on something that will assist people to create cave systems within this terrain?

    1. I don’t have any insider knowledge, but while I’d love caves, it might be more realistic to simply be able to poke holes in the terrain mesh sooner. Then, at least, we can use a mesh lined up with the hole to make a cave.

  7. 번역이 참 잘 되어 있는 것 같습니다. 이해를 돕는 적절한 의역과 함께…

  8. Spelling error: «publically» is not a word. It should be, believe it or not, «publicly». Check your thesaurus.

  9. spherical terrain would be nice so that the terrain system can be used to create planetary terrain!

    1. In theory you can create Spherical Terrain using the terrain system. If you use the Latitude and Longitude values as your starting points, then convert to world coordinates using sin/cos conversion formula. You can then procedurally place a terrain, define it’s latitude/longitude/degrees per metre settings to create a patch of the world around the player using a noise generating system similar to libnoise. Knowing the latitude/longitude values for the terrain patch will allow placement of objects recorded at specific coordinates. I’ve been playing with this side of things for a while now and at least prior to these new terrain changes it was working as expected. Just need to look into the new way it works to see what needs to be changed to make it work.

  10. Ahmet Han Furkan Kahveci

    Октябрь 19, 2018 в 10:22 дп

    Please let developers can change quality (low tris/low poly) terrain for mobile and standart render pipeline new mobile shaders.

  11. I advise Unity staff to add a Terrain roadmap as soon as possible, preferably after any Unity LA announcements. Doing this soon will enable the crowd to calm down as they view luminous promises like «some sort of hole hack».

  12. Caves and Caverns with Terrains PLEASE!!!! I have my cutest sad puppy face on right now so you have to do it.

    1. Caves in terrain editor will never be a thing since it uses 2D heightmaps unless every game engine in the world change the way they generate/sculpt terrains.

      1. Nonsense. All Unity needs to do is support is cutting holes through the collision using an alpha mask, and developers can use cave kits etc. with having to generate their own costly custom collision for every terrain.

        1. (*without, not with)

        2. You have been able to use an alpha mask shader in conjuction with terrain to hide it for some time now. The problem is this doesn’t affect the terrain collider, but you could have a script that turns off collision with the terrain while the player is in that hole you created.

  13. I don’t know more expected improvements for us than a terrain system with caves, multi textures and generally everything that is needed to create an open world … there can only be an ai system .. but no. The landscape system is the foundation for everything. please do it. hoping for the best, Michael.

  14. Streaming terrain (from local source) a-la Google earth please.

  15. Is anything being done about the issue with wind zones and terrain grasses? That being that wind direction does NOT have affect on the direction the grass waves? Re: 922123 — Wind Zones and Terrain Grass Texture Detail — 06/18/2017

  16. It’s nice to see more content moving to the GPU. Will it be possible to read and write the terrain height map buffer from a compute shader? It would be nice to have GPU access to terrain features to modify terrain height and textures at high speed during runtime.

    1. ++, asked the same down below (fun fact: also exactly at 6:05pm)
      They’ll have trouble with that because colliders/grass or even seperately stored tangents/normals might be out of date.
      Obvious answer would be to give tools PRECISE control over everything — when to update which layer, e.g. (copying from my post):
      Render to height and update just normals/tangents for rendering, update grass at intervals (low priority) and only recalculate colliders when finished. Similar to how tools interact with VegetationStudio already.
      This will be a huge win for true interactive terrain creation tools. I currently use a custom lightweight proxy terrain system, else I would spend 10x more time updating the terrain than I would actually simulating stuff. Needs adressing…

  17. please add GIS file support such as DEM and easier to manipulate scale for real world terrain for example group of terrain patch from tile raster.

  18. Planetary terrain possible? I mean cube rounded with stitch as 3 sided poles?

  19. Any hope for some spherical terrain? Such as planets.

  20. Please add a Terrain specific roadmap. Last I heard Will Goldstone had done some research into improved roadmaps.

    But until then, Terrain seems such a big thing so why not give it some space on the roadmap?

  21. It looks like a polished up, modernized, more accurate/better looking version of the old system, some some tool tweaks.

    Not exactly a leap forward in terms of terrain.

    Consider for example being able to destroy and create terrain in realtime, the ability to have 3D volumetric terrain with holes and caves and tunnels and overhands and all that unbridled 3D freedom, the ability to turn the level data into a geometry-shader-generated voxel world (ala minecraft but made into cubes on the gpu), being able to ‘paint materials’ onto the landscape at runtime as part of gameplay, etc…. Unity was allegedly starting to work on things along these lines YEARS ago and it still hasn’t seen the light of day and not a single mention of any of this in this blog post.

    Seems to me like decade-old terrain technology with icing on top.

  22. Even the Roblox terrain system has support for caves.

    1. Even? Roblox is a superior in-game game engine.

  23. Holes please terrain team.

    1. Creating caves and entrances would be HUGE agreed with u @Whippets

  24. Would be nice to edit the terrain height on their own layers as well, so I can make large topology changes on one and finer details (or load a map) on another, blend together for final height without destruction. I mean this for editor side only so the build gets a merged heightmap for memory/perf purposes.

    1. There’s an asset for that incase you didn’t know, although I suppose you do from the way you worded it.
      It’s called Mad Maps, and does that job superbly it seems.

  25. Do you have plans to implement origin reset for large worlds to avoid float precision errors that affects physics primarilly.

    1. how about to freeze the camera in origin and made the terrain moving instead

      1. That’s not as easy as it sounds. Code from other assets might malfunction, and forget about baking lightmaps…

  26. aaand just like that, the final thing i have been waiting for is about to land. Thanks guys, this and the VFX editor coming are a dream come true

  27. Do you consider updating tree creator trees? (With instancing)

  28. Hope the terrain team and the team that makes those toolkits can come together and make some good examples on different types of terrain — simple, detailed, with caves, with mesh cliffs (ie starcraft 2/dota 2) ++ because the tools and examples for different terrains has been incredibly lackluster ;/

  29. Could you expose access to height fields for allowing us to make our own colliders in the same vein that the TerrainCollider in Unity does without us having to use the Terrain system? I’d love that for a project I am working on that involves a large tile-based terrain that doesn’t work well with how Splat Maps work in Unity’s default terrain engine.

    1. This would be a dream. I’m facing this exact issue right now.

    2. Yes, we want to make it possible to create Terrain ‘from scratch’ in C#, which requires something along the lines of a standalone heightmap collider. But it doesn’t have an ETA yet.

      1. Somewhat related, please let us have access to the underlying heightfield directly so we can render to it (and replace it with an own RenderTexture if need be). To adress related issues such as colliders, grass, normals, … being out of date, just expose an API to give precise control over which layers to update in which areas. E.g. Render to height and update just normals/tangents for rendering, update grass at intervals (low priority) and only recalculate colliders when finished.
        This is an absolute must for terrain creation tools requiring true interactive speeds…
        Currently forced to create an own proxy terrain system, lightweight and super fast:
        https://gist.github.com/Seneral/6362c420a7a80228fc6614ff94763000

  30. So, no per pixel normal sampling in LWRP? ie it’ll look like that left image?

    1. Per-pixel normals should work in LWRP, HDRP and built-in renderers. But for HDRP or LWRP, you will need to upgrade to the latest preview packages to get the shaders with instancing support (version 4.0.1 — make sure you’ve turned on advanced -> Show Preview Packages in the Package Manager).

      1. Cool, sorry the post was just confusing. It says «The HD shader was further enhanced to support per-pixel normal» which implies that the LWRP doesn’t get this feature.

  31. Good first step. As others have pointed out, next we need some proper vegetation (plants/grass and trees), including support for wind zones or settings that impact both.

  32. Love the direction of the new terrain stuff, how do I punch a hole in it?
    I’ve got a cave, a tunnel, a subway system.
    Through the ground……into a hole :-)

  33. you can try also heightfield approach how Houdini is doing it https://vimeo.com/202435893 check time 4:33

  34. Nice changed to the terrain. The ability to use custom textures on the brush is nice, though I do still wish for the ability to create caves in the terrain, maybe converting terrains to voxel to do it. Good job though, really cool!

  35. It’s definitely a start. What I’d really love to see is procedural tools for splat mapping and detail distribution/randomization, a new terrain shader with texture array support(with a higher than 8 texture limit — also with procedural mix support, similarly to the MegaSplat asset, let me define a bunch of materials as lets say «dirt» and let me just paint «dirt», at any point I want to be able to add or remove materials with automatic updates), some sort of object-to-terrain blending, and quality vegetation shaders(and by that I mean something that’s standard for like 10 years now, on top of PBR we need SSS as well(yes, I’ve seen ST8 with PBR shaders listed as a 2018.3 feature, however SpeedTree 8 modeler isn’t available yet and it’s listed as TBD on the SpeedTree website — and frankly considering how awful SpeedTree support was in Unity since it was introduced I don’t see why it’s even there, just write a few new shaders, touch up the billboard system and let us import meshes as trees easily(or add a shit ton of features to the TreeCreator, but that sounds unreasonable)).
    I was looking forward for some terrain improvements for a really long time, fingers crossed for 2019!

  36. Ahh, this all looks incredible! It’s fantastic to hear that Unity will have a dedicated terrain team now, it’s about time.

    I’m curious about things like custom shaders and whether or not they’ll still be supported? Also, it’d be great to be able to switch out materials/shaders for individual detail objects (like having different materials for each type of grass). A built-in system for building smooth ramps would be nice too.

    Anyways, it’s looking great guys! Thank you so much!

  37. would love it if you could paint with materials that have a height maps. Would make Megascan textures really come out how they are suppose to :)

  38. Hey, as long as you’re adding features to terrain, is there any plans for creating holes in terrain? Even if it’s limited to quads at the lowest level of detail, it would still allow caves and such.

    1. Holes are also being worked on actively.

  39. Your team may already be aware that a method exists where a second terrain could be made under the «ground terrain» in which a water shader would be applied so that instead of a water plane, we could have a «water terrain» so that we can raise and lower water on different areas of the «ground terrain». I’d love to know your thoughts on such an implementation!

    1. Can’t you just use a quad and a mask for this?

      1. There are benefits to using a terrain which the shader moves the water texture based on the angle of the current triangle. in this way you could create slow moving rivers and fast moving waterfalls.

  40. This great news! Good job, just keep it up!

  41. Hey @Osama S.Ahmed! Unity Team is actually working on a new UI for the Editor: https://youtu.be/CWgi6hE26ig?t=311

  42. EXCELLENT!
    I’m loving the progress so far, looks like you guys are really focusing on making open-world much easier with the terrain engine (which, of course, would be the most popular use of a terrain engine I should imagine!)

    Are there any plans to focus attention on the vegetation system as well? Last I messed with it, vegetation rendering left…. much to be desired. Even with instancing enabled it tended to produce tons of small instanced batches instead of few large batches which would really help alleviate CPU pressure — third party solutions worked and were much faster, but had a tendency to be rather cumbersome.
    More focus on rendering smaller vegetation like grass and flowers in an efficient manner would be quite nice too.

    1. Yes, Grass, Details, etc. are being worked on currently.

      1. Great news! Since you are working on it, could you please decouple the foliage/vegetation system from the terrain so we can use it on any surface?

        Given the size of the target audience, I can’t imagine that you will want to put the effort in required to create a terrain system that can in realtime, procedurally update its mesh by using an algorithm such as Cubical Marching Squares or Manifold Dual Contouring to allow creation of No Man’s Sky like (but better) games with Unity. However, if you at least decouple your foliage/vegetation system from the terrain system, that would go a long way helping the people who are working on procedurally generated games by taking off that load of their shoulders.

  43. currently i’am using Unreal for my game but definitely i will pickup Unity on my next game project .. the engine features are flooding in each update . love to see the team changing the engine UI cause its look old and look forward to see more stuff for the HD pipeline .. Best regards

    1. Hey @Osama S.Ahmed! Unity Team is actually working on a new UI for the Editor: https://youtu.be/CWgi6hE26ig?t=311