Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Best way to cut holes in the terrain?

Discussion in 'World Building' started by kirilli, May 2, 2019.

  1. kirilli

    kirilli

    Joined:
    Mar 5, 2019
    Posts:
    34
    I need to cut holes in Unity terrain. What is the best way for me to do that?
    upload_2019-5-2_10-40-24.png
     
  2. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,332
    DavidLieder and jbooth like this.
  3. kirilli

    kirilli

    Joined:
    Mar 5, 2019
    Posts:
    34
    Thank you!
     
  4. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    This will also be a feature in Unity 2019.3
     
  5. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    84
    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:

    https://assetstore.unity.com/packages/tools/terrain/microsplat-terrain-holes-97495

    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:

    https://assetstore.unity.com/packages/tools/modeling/mesh-combine-studio-2-101956
    https://assetstore.unity.com/packages/tools/terrain/mcs-caves-overhangs-144413
     
    Last edited: May 15, 2019
    Fibonaccov, Phoenix116 and Rowlan like this.
  6. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    84
    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.
     
    nobluff67, Flavelius, Recon03 and 4 others like this.
  7. kirilli

    kirilli

    Joined:
    Mar 5, 2019
    Posts:
    34
    Thank you guys I will give Microsplat a try.
     
  8. dontdiedevelop

    dontdiedevelop

    Joined:
    Sep 18, 2018
    Posts:
    68
    This is not a completely new feature :D 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)
     
    AdamCourtenay likes this.
  9. ChrisTchou

    ChrisTchou

    Unity Technologies

    Joined:
    Apr 26, 2017
    Posts:
    74
    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!
     
    twobob, Flurgle, Mauri and 5 others like this.
  10. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    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
     
  11. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    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.....
     
  12. dontdiedevelop

    dontdiedevelop

    Joined:
    Sep 18, 2018
    Posts:
    68
    This is unity feature buddy of course it's supporting colliders too this is not a asset
     
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    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.
     
  14. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    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.
     
    sivrikaya, twobob, Mauri and 5 others like this.
  15. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Excellent news! I was waiting for this to improve Digger!
     
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah and no, Unity's not making entire caving systems as others might've implied :D
     
  17. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    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
     
  18. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    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.
     
  19. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    84
    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.
     
    Recon03 likes this.
  20. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,332
    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)

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. /***
    4. * Add empty gameobject.
    5. * Add collider to it, set to IsTrigger.
    6. * Add rigidbody, set IsKinematic.
    7. * Add this script and set gameobject and terrain in inspector.
    8. */
    9. public class EnterHole : MonoBehaviour
    10. {
    11.     public GameObject player;
    12.     public TerrainCollider terrainCollider;
    13.  
    14.     void OnTriggerEnter(Collider c)
    15.     {
    16.  
    17.         if( c.gameObject == player)
    18.         {
    19.             terrainCollider.enabled = false;
    20.         }
    21.     }
    22.  
    23.     void OnTriggerExit(Collider c)
    24.     {
    25.         if (c.gameObject == player)
    26.         {
    27.             terrainCollider.enabled = true;
    28.         }
    29.     }
    30. }
    31.  
    Looks like this (the capsule collider is the terrain enabled toggle):

    hole.gif

    edit: had to make a vid of it :D

     
    Last edited: Jun 2, 2019
    swimswim and Noisecrime like this.
  21. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    - The Terrain shader is still single-sided
    - The only time the collider won't allow you to click "through" the masked areas is when you are painting the surface mask texture with the Terrain Tool.

    This is all extremely cool!
     
    Rowlan likes this.
  22. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    Exactly, that's what I mean: thanks to Unity we will have the perfect tool to create hole/cave entrances and Digger will be a perfect companion as it creates the cave mesh that will still be missing (if you want to create natural caves).

    Today, Digger has to generate big collider meshes + box triggers to do the trick. Tomorrow, with the official hole feature, Digger will just have to generate a collider mesh that correspond to the cave itself and that's all. Thanks to this, Digger will be faster and more robust. :)

    BTW, I'm about to release an update for Digger. It's going to support in-game, real-time digging so basically any Unity terrain will hold the power of a voxel terrain.
     
    wyattt_ likes this.
  23. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    451
    @wyatttt BTW, do you plan to provide a triplanar version of the terrain shaders? That would be really great!
     
  24. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,332
    Amandin-E and wyattt_ like this.
  25. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    I can't say for sure. We do plan on making it easier for users to do that themselves though
     
    Amandin-E likes this.
  26. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    Yup smart move , we also wait before we use new versions but we will use new versions for test versions and to learn anything new.....but we wont use newer versions for 6 months to a year... right now we just moved maybe a month ago to 2018.3.. from 2017. we wont use 2019, until Xmas, other than in some test builds. and for learning new stuff.