With Unity's terrain creator, I can't simply make a "hole" on the mesh.

I don't know how I would make cave-like structures other than using "rock" meshes for the roof (wich will indeed look weird) or using portals (wich I always have problems with -- the teleportation isn't thruly smooth and there's always a small "jump". You know, not like a fluid thing.

How can I make caves in terrain with Unity?

  • \$\begingroup\$ Why not use one mesh matrix for the floor and one for the ceiling? \$\endgroup\$ – AturSams Jan 30 '14 at 17:24
  • \$\begingroup\$ Maybe it's just that I'm that slow, but I really don't imagine what you're trying to point right there. \$\endgroup\$ – Iridium616 Jan 30 '14 at 17:37
  • \$\begingroup\$ I was wrong. The most recommended way is using Blender. \$\endgroup\$ – AturSams Jan 30 '14 at 17:46
  • 2
    \$\begingroup\$ Unity terrain is heightmap based, which fundamentally cannot support overhangs (such as caves and arches). This isn't really possible without making the roof from some other mesh. Unity Terrain was never "intended" to make caves and such. In fact, like all heightmap systems, it doesn't even do cliffs very well. \$\endgroup\$ – user41442 Jan 30 '14 at 17:52
  • 1
    \$\begingroup\$ I never used it, but Robert Yang once posted a possible solution for this on his blog. Maybe that works? \$\endgroup\$ – xeophin Jan 31 '14 at 7:42

Starting from Unity 2019.3, you can properly cut holes in terrain surface (see https://blogs.unity3d.com/2019/08/27/unity-2019-3-beta-is-now-available/#attachment_82836) However, this won't create the cave mesh for you.

If you are looking for a terrain hole system that creates meshes automatically you may want to use a plugin like this one: https://assetstore.unity.com/packages/tools/terrain/digger-terrain-caves-overhangs-135178


You can't make a cave in Unity's terrain system natively because it uses a 2d heightmap, where each point can only have one height.

This allows for some major optimizations (and a radically different approach) compared to a system that allows for 3D height definition.

But there is an easy work around that AAA games have used (including certain CryENGINE games). Simply make a hole in the terrain and place a mesh representing the cave.

There are different approaches to making holes in a terrain like Unity's. I like the approach taken here for being robust and easy to modify.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.