Terrain hole / cave entrance

I thought this must have been discussed a lot or at least have some good blog posts, but so far no luck.

How can I simply create a visual hole in my terrain, like for a cave entrance. I am using the Standard Terrain Shader.

I understand there must be some workaround, and that I can toggle the terrain collider by script.

Thanks for you help!

1 Like

If it is visual only, you would want to change the shader to be cutout. You’ll want an Alpha Cutout. It’ll clip based upon the alpha in the diffuse texture, instead of transparency. I’m not actually sure on the terrain shader without pulling it up, the standard shader has those features, but I don’t use unity terrains either (voxel-based terrains in my case), so I haven’t used their built in shaders for that.

If it’s not, that is what you want to look for - if I get any time, I’ll check it out. But with that, you can design the texture to clip that area and adjust the clip percentage (basically, what level of alpha is clipped, if it clips at .3, .7, .9, etc) via script.

Hey, thanks for the help.

I have used the Alpha for cutout effects with the Standard Shader (for meshes) before, and it is very useful. That said, I don’t think the Standard Terrain Shader does have this kind of feature, since the Alpha (of the Diffuse/Albedo) channel is used for the Roughness of the texture, as far as I understand…

Sadly, I have zero experience with shaders. The Terrain shader seems to work with two passes also, sounds complicated to me? :frowning:

In my research I found some custom Terrain shaders for cave entrances and Alpha implementation, but they are very old and of course do not feature what the Unity 5 Terrain shader can do.

Bumping, because there must surely be a way to cut a visual hole (transparent texture) into the Unity 5 terrain (Standard Terrain Shader)?

I think you’ll have to modify the shader terrain (is it even possible?). Why don’t you use a voxel based terrain?

Hmm, I thought I could use the Standard Terrain Since there is only one single hole in the entire landscape (entry to a small underground area).
Is there a free voxel based terrain asset you know of?

Did you ever come up with a solution for a hole in the terrain using the Standard Terrain Shader in Unity 5?

There’s endless resources and assets devoted to this problem. Even a minor google throws up what is available. And no, nothing new has occured, nor will it until Unity update terrain.

Sadly, no. But I did not invest a lot of my own time yet to explore if I can find my own solution to this problem. There is the option to get a voxel terrain plugin from the asset store.

Thanks for the update. Although, I didn`t find any free solution that is not outdated or badly documented. If you got a good reference, please let us know :slight_smile:

1 Like

I’ve looked since but we’re on meshes now and have downsized the scope of the game a tad. Unity is not ready for this game so we downsized the game. It is more sane than switching engines which also has no guarantee of success. Guarantee would be me hiring dedicated staff, not switching engines.

In my game, I didn’t bother cutting a hole in the terrain. I just lowered the terrain where I needed to put the cave, and then slapped a second (much smaller and lower resolution) terrain over the top of it. Much easier, and came out looking perfect - you just have to adjust the tiling on the mini-terrain to match the main one.

Good idea, but I feel like when there are a few cave entrances, it is too resource heavy and complicated? :frowning: Also, did you cover up the missing space with 3d meshes or how did you create a hole then?

1 Like

It’s not too intensive. A small terrain (like 32x32) has very little overhead actually. If you had terrains that were high resolution, or a lot of polygons, yeah it would be bad. You have to put meshes around the entrance just like you would with a terrain “hole”.

Hey, thanks for the explanation. I’ll go with that :slight_smile: