2
\$\begingroup\$

I know there are many threads about this but none of them seems to work for me and I spent like 2 days already on that problem. Things that I've checked:

It's like I see the way to accomplish that but can't really glue all the pieces together. It seems that to make a "hole" in terrain we have to:

  1. Place an Cube/Plane with depth-mask shader onto our terrain (mountainside e.g)

  2. Add collider to it and script with OnTriggerEnter/Exit where we have to ignore collision between player and terrain

  3. Put an object with our cave system (made in 3ds/blender) inside our mount-shaped terrain and camouflage the edge of entrance with other objects e.g rocks so we wont see any artifacts.

terrain with simple caves

I don't want to use voxel terrain, instead of depth-mask I could use transparent terrain texture paint option.

Do You know any working example for version 5.3.5 or could You help me somehow with it?

\$\endgroup\$
1
  • \$\begingroup\$ "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site." \$\endgroup\$
    – Bálint
    Jul 19, 2016 at 5:37

1 Answer 1

6
\$\begingroup\$

I have little experience using Unity directly, but I've been a level designer for years and a much easier approach rather than worrying about cutting holes into your terrain is to simply build up a C shaped ridge in your terrain for the size of your cave and then cover it with rock meshes to give it the illusion of a cave.

Landscape Cave Method

Another approach is that you could even forego pulling up the landscape all together and simply use the rock meshes to build the cave as this will likely look more realistic. I think using a terrain to actually form mountains and landscape is a very old-school approach to level design that no longer looks realistic. If using terrain, I only use it to form the ground you walk on and instead use rock meshes to build up the mountains, cliffs and caves/caverns and maybe the occasional sculpted terrain for the background mountains (though I even make these in Mudbox and World Machine and import them as a mesh.

If you're trying to create a system of underground Caverns that you can walk down into from your terrain, rather than cutting holes in the terrain, I would use meshes to form the mouth of the cave and then create a level transition point there that loads another map all together containing your caverns and then build the caverns entirely from rock meshes. Not only will this look better than trying to use a terrain to build the caverns, but you'll get better performance by making the caverns another level and using instancing on your rock meshes.

If creating a multiplayer map, I would either place the Cave mouths at the edges of my terrain and simply form the caverns using meshes that walk the player below the terrain mesh. OR you could add a teleport script at the back of the cave mouth that teleports you into the caverns below the terrain. There are a multitude of different approaches you could take to make the transition look seamless and still not need to actually cut holes in your terrain.

Something else to consider is that if you DO cut holes in your terrain, the LOD system will sometimes cause the holes to change in size and show gaps in the terrain where there shouldn't be. All in all, I don't ever recommend doing this as there are much better solutions as I outlined above.

\$\endgroup\$
4
  • \$\begingroup\$ Wouldn't it be too expensive (performance wise) to build mountains and stuff using meshes? \$\endgroup\$ Jul 19, 2016 at 19:17
  • 1
    \$\begingroup\$ Not more expensive than a terrain no. You can control exactly how many polygons are on the screen, you can create LODs for the meshes, you can rely on occlusion to remove the meshes from the render and you can use instancing to lower the draw call. Of course it would all depend on the complexity of the terrain you're comparing it to, but for the most part a poly is a poly. Where it makes a difference is in your materials and instancing but a terrain can use a very complex material or a more simple one. I'd say for the most part the meshes would be less expensive but it depends on the situation \$\endgroup\$
    – TorQue MoD
    Jul 20, 2016 at 2:52
  • 1
    \$\begingroup\$ My idea was to cut holes because I could use foliage/object paint system on it. \$\endgroup\$ Aug 1, 2016 at 23:27
  • \$\begingroup\$ i.imgsafe.org/fdac7e1531.jpg \$\endgroup\$ Aug 1, 2016 at 23:27

You must log in to answer this question.

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