Search Unity

Unity 2018.3 における地形作成システムのアップデート:スタートガイド

, 10月 10, 2018

Unity は地形作成システムの専門チームを立ち上げました。初めての努力の成果が近日中に公開されます!Unity 2018.3 には、地形作成システムのアップデートが搭載される予定です。このアップデートの特徴は、GPU をもっとうまく利用することでツールやパフォーマンスが改善される点です。また、従来の組み込みのレンダーパイプラインや既存の Unity 地形作成システムとの後方互換性を確保しつつ、HD レンダーパイプライン(HDRP)ライトウェイトレンダーパイプライン(LWRP)というレンダーパイプラインのサポートも追加されます。

今すぐ Unity 2018.3 ベータ版を入手してアップデートを先取りしましょう!ベータ版はまだ開発中のため、ユーザーインターフェースも API も変更される可能性があることにご注意ください。

パフォーマンス

パフォーマンスの面では、GPU インスタンシングが実装されたレンダリングパスを地形作成システム用に追加しました。ほとんどの場合は、インスタンシングにより、発行されるドローコールの数が劇的に減少します。Unity が行ったテストの多くでは、CPU コストが 50% 以上削減されることがわかりました(ただし、当然ながら実際の数値はプラットフォームやユースケースに応じて異なります)。この新しいレンダリングパスを選択するには、「Terrain Settings」で「Draw Instanced」を有効にします。

有効にすると、Unity では、ハイトマップやスプラットマップなどの重たい地形データがすべて、GPU のテクスチャに変換されます。CPU 上の地形のパッチごとにカスタムメッシュを作成する代わりに、GPU インスタンシングを使用すると、1 つのメッシュを複製してハイトマップのテクスチャをサンプリングし、適切なジオメトリを生成できます。これにより、数千ものカスタムメッシュの描画がインスタンス化された少数のドローコールに置き換えられるため、地形作成の CPU 負荷は大幅に低減します。

良い副作用として、ロード時間も改善されます!このようなカスタムメッシュすべての作成をスキップするだけでなく、GPU を使ってベースマップ(あらかじめブレンドされた LOD テクスチャ)を作成することもできます。そのようにした場合は GPU の処理速度がさらに速くなります。これは、自作のテレインシェーダーがあれば、「ベースマップの作成」用シェーダーをオーバーライドし、対応するベースマップ LOD テクスチャを生成できることも意味します。

地形のビジュアル

インスタンシングにより、地形の法線の現れ方も改善されます。地形のメッシュの法線は、ハイトマップから生成されてピクセルシェーダーでサンプリングされる法線マップテクスチャに格納されることで、ジオメトリから切り離されました。つまり、法線はメッシュの LOD レベルとは関係ありません。その結果、「ピクセルエラーの発生率」が上がる代わりに、アーティファクトの発生を抑えつつ、頂点コストを削減することができます。

以前の頂点ごとの法線(左)と新しいピクセルごとの法線(右) – トライアングルの数は同じ

また、HDRP と LWRP 両方用にテレインシェーダーを開発しました。これらは、バージョン 4.0.0 以降のパッケージで提供されており、インスタンストレンダリングとピクセルごとの法線をサポートしています。HD シェーダーは、高さと密度のブレンドモード、法線のスケーリング、テクスチャで制御されるサーフェスのメタルネスとスムースネスなどの新機能をサポートするようさらに強化されました。HD テレインシェーダーは、シングルパスレンダリングに限定されていますが、地形レイヤーを 1 つのパスで最大 8 個までブレンドできます。

スクリプタブルな GPU ツール

エディター側では、独自の地形作成ツールを作成するためのスクリプト API を公開しました。一連のユーティリティー関数とともに使用すると、GPU 上でタイルをまたいだシームレスなスカルプティング操作やペイント操作を簡単に実装できます。新しい TerrainAPI には、TerrainPaintTool(地形作成ツールの基底クラス)、TerrainPaintUtility(地形データを変更するためのユーティリティー関数を含む)が含まれています。

このような変更を適用することで、既存の地形作成ツールをすべて、GPU で動作するように変換しました。その結果、これらのツールの処理速度が速くなったほか、より大きなサイズのブラシ、ブラシのプレビューの改善、継ぎ目の自動スティッチングによる地形タイルをまたいだペイント操作も実現しました。

新しい地形スタンプツールのライブプレビュー(2018.3b6 以降)

また、ブラシの回転やランダム化などのブラシ機能、ハイトマップやメッシュスタンプのようなより高度なペインティングツール、クローンブラシなどを使っていろいろ試すようにもなりました。こうしたペインティングツールの機能は、現時点では 2018.3 に含まれていませんが、GitHub の Terrain Tools プロジェクトから入手できるようになっています。

複数の地形のサポート

複数の地形タイルを使った作業が簡単になりました。地形をまたいだシームレスなペイント操作に加えて、隣接する地形との接続の自動管理が可能になりました。以前は、隣接する地形を接続するためのスクリプトを手動で作成する必要がありました。

「Terrain Settings」の「Auto connect」を有効にすると、その地形は、同じグループ ID を持つ隣接する地形と自動的に接続されます。

既存の地形を拡張する場合は、新しい「Create Neighbor Terrain」ツールを使って、隣接するタイルがない境界線に沿ってマッチする地形タイルを簡単に追加することができます。

また、サイズ変更や解像度の変更があまり破壊的な変更にならないように取り組んでいます。2018.3 では、ハイトマップとスプラットマップは、データを消去して作業内容をすべて失うという以前の動作ではなく、その解像度を変更したときにリサンプリングされます。近い将来、あらゆるサイズ変更操作を改善することを目標に日々取り組んでいます。

新しいアセットタイプ

ワークフローを簡素化するために、TerrainLayer アセットと Brush アセットという、地形に関連した 2 つのアセットタイプも新しく作成しました。

TerrainLayer を使用すると、地形オブジェクトとは関係なく地形マテリアルを定義できるため、複数の地形間で同一のマテリアルを簡単に追跡できます。これは、シームレスなペイントやマテリアルの変更に役立ちます。さらに、TerrainLayer アセットを「マスクマップ」テクスチャに対応するよう拡張すると、任意のシェーディングに使用できるようになるほか、スクリプトインターフェースを拡張すると、シェーダーに依存するカスタム GUI が TerrainLayer アセットに提供されます。
Brush アセットは、ペインティングツールやスカルプティングツールで使われる GPU ブラシシェイプを表します。このようなアセットは、テクスチャと放射状の減衰カーブで定義されます。そのため、ブラシシェイプの作成と調整は非常に簡単になります(以前は、作成した画像ファイルを特別な名前の付いたフォルダーにドロップする必要がありました)。

R16 テクスチャ形式(単一チャンネルの 16 ビット形式)のサポートも追加しました。これにより、ハイトマップのスタンプとして使った場合にエフェクトが望ましくない「階段状」になる原因である 8 ビットの量子化をブラシシェイプで回避できるようになります。

「階段状」のアーティファクトを示す 8 ビットのブラシスタンプ(上)と、16 ビットのブラシスタンプ(下)

Unity の地形作成システムのチームはまだ始動したばかりのため、開発は今後も続きます。ぜひ World Building フォーラムからフィードバックをお寄せください!

69 コメント

コメントの配信登録

コメント受付を終了しました。

  1. A.J. Soltani

    12月 9, 2018 8:01 am

    Excellent !
    Thankful

  2. Isaac Surfraz

    12月 7, 2018 2:25 pm

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

  3. Pierre Proudhon

    12月 5, 2018 1:49 pm

    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. John Rockefeller

    12月 4, 2018 2:46 am

    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. John Rockefeller

      12月 4, 2018 2:48 am

      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

    10月 19, 2018 10:22 am

    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. William DiGiacomo

    10月 13, 2018 1:23 am

    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. Robert Cummings

    10月 11, 2018 8:51 pm

    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. ImaginaryHuman

    10月 11, 2018 7:07 pm

    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. UG3 Productions

      10月 11, 2018 4:47 pm

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

  24. Robert Cummings

    10月 11, 2018 2:10 pm

    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. Isaac Surfraz

    10月 11, 2018 10:14 am

    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. Matthew Radford

      10月 11, 2018 5:48 am

      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. Osama S.Ahmed

    10月 10, 2018 10:23 pm

    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