I need to cut holes in Unity terrain. What is the best way for me to do that?
You can do that with the Microsplat Terrain Holes plugin:
Thank you!
This will also be a feature in Unity 2019.3
Microsplat is great but there is a learning curve. Be prepared to take some time and study the manual (which is well-written). You have to first download and import the asset Microsplat Free, which means your terrain has to have a few requirements: all textures must be the same size, make a backup of your project, and don’t try to install Microsplat and then remove it (just do it or don’t do it because it has some imposing qualities which will embed it into your project, but with great results).
Then you will need to get the asset for the terrain holes, only $5:
Learning Microsplat will improve all your terrains in the future. It’s great but you really have to study it a bit. Although you’ll get your terrain holes and better terrains for $5.
If you want an easy and expensive solution for terrain holes (and lowering your FPS count) then get these two from Nathan. Mesh Combine Studio is easy plug-and-play and completely different than Microsplat. Microsplat is texture arrays, but Mesh Combine Studio is combining meshes:
No offense intended, but a “feature” probably means preview and it will be usable by 2020 or later. I think the guy wants some terrain holes without waiting two years.
Thank you guys I will give Microsplat a try.
This is not a completely new feature This is just a new implementation on Terrain System so i think he can use the feature when 2019.3 is come(currently in alpha)
Terrain holes have just been merged in yesterday!
It should be available in 2019.3 alpha within the next two weeks.
HDRP and LWRP support for holes is also in the pipeline, and should be available soon.
Please let us know if you discover any issues!
what about colliders ? this has been one of the biggest issues…for Holes is passing through, for years we have had to hack it to pass through colliders…so has this been dealt with as well yet? if not, when? Thanks
well for years we had to use triggers to pass through typically which is very hacky…so lets hope they fixed this…we been asking for it since Unity 3…This is a big issue…I hope they fix it like Unreal…or something like it…I hope its not IGNORED… The terrain collider that is…
haha, we been asking since Unity 3, to fix the terrain collider issue…which is the issue for holes.
but my guess is they only added the shader for holes, something we could always DO before… on our own…colliders is one of the biggest issues…
This is unity feature buddy of course it’s supporting colliders too this is not a asset
The terrain holes were delayed AFAIK before, because they needed to work correctly for GI, for collision etc, so I anticipate that while the visual side is left up to the pipeline (always been possible to cutout) it’s the work with colliders and other stuff that’s taken the longest.
The generation of the Terrain Collider takes into account the Surface Mask (this is the holes clip mask) so you will get collider geometry that matches the holes you’ve painted on your Terrain. Should also work with NavMesh generation. There may be a few issues with GI still regarding texel validity but there should be bug reports tracking that already.
When we want to merge a new feature or changes to an existing feature/system, we have to make sure the changes still pass all of our tests. With Terrain holes, we had to update a lot of those so that they wouldn’t fail. That along, with the other system interactions, took some time, as @hippocoder mentioned.
Excellent news! I was waiting for this to improve Digger!
Yeah and no, Unity’s not making entire caving systems as others might’ve implied
Thanks for giving more input. about this…
good sounds like its going to be something like Unreal…so I’m glad you guys listen to our feed back for years, we asked for this…that we could paint, and this would deal with the collider and surface mask into account… kinda like Unreal. Thank you
I was giving an example, I been here since Unity 3. so I’m aware of what Unity is doing and what is an ASSET LMFAO… I also don’t do game dev for a hobby, so this part was important… I see this information and wanted UNITY them selves to be clear on what part was being done…if not all… I like to hear from the horses mouth, since this is our business and important to us, on where Unity is going. SO I LIKE real facts from them…and Wyatt answered , so I 'm happy I got the info I was looking for…first time I heard this. from someone from Unity them selves.
That’s all good and I’m glad Unity is adding it, but does anyone use “alpha”? The devs I’m friends with who are Unity adepts never use a version until six months or a year after it is released as a “ready” version, due to bugs, assets not being compatible, and general things that are updated over time.
Everyone loves real progress in the Unity engine, but it’s sometimes hard to tell when a version is actually stable.
Some questions regarding the version by Unity
- What about the terrain shader? Is it double sided?
- What about the editor? Does it work with holes or is the terrain a collider preventing you from selecting “inside” objects?
Also, to answer the OP’s question, here’s quick steps about how to use Microsplat Terrain Holes:
-
select all terrains and add the Micro Splat Terrain script, then hit “Convert to MicroSplat”
-
select the MicroSplat material and activate Alpha Hole
select the index of the texture which should be rendered transparent
paint the hole using that texture -
add an empty gameobject “HoleTrigger” in front of the hole
add a collider to it and activate “Is Trigger”, resize the collider
add a RigidBody to it, disable Use Gravity and enable Is Kinematic -
add script EnterHole.cs, assign your player gameobject to player, the terrain to terrainCollider
(that’s brute force, you might want to use Physics.IgnoreCollision)
using UnityEngine;
/***
* Add empty gameobject.
* Add collider to it, set to IsTrigger.
* Add rigidbody, set IsKinematic.
* Add this script and set gameobject and terrain in inspector.
*/
public class EnterHole : MonoBehaviour
{
public GameObject player;
public TerrainCollider terrainCollider;
void OnTriggerEnter(Collider c)
{
if( c.gameObject == player)
{
terrainCollider.enabled = false;
}
}
void OnTriggerExit(Collider c)
{
if (c.gameObject == player)
{
terrainCollider.enabled = true;
}
}
}
Looks like this (the capsule collider is the terrain enabled toggle):
edit: had to make a vid of it