Search Unity

Mcs Caves & Overhangs [RELEASED]

Discussion in 'Assets and Asset Store' started by eagle555, Apr 11, 2019.

  1. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    The MCS Caves & Overhangs extension for MeshCombineStudio 2 is available on the Asset Store now.

    The best performance possible by using the easiest way to get amazing looking caves and overhangs on any terrain solution.

    The easiest way to create caves and overhangs (and best looking) is by placing rock models within Unity Editor (in conjunction with terrain). The issue is that it's bad for performance because there's a lot of rock geometry (triangles) that overlap with other rocks or are below the terrain. So many triangles are draw that are never visible and this also results in overdraw on the GPU which reduces performance. This MCS extension solves that issue in a few clicks and removes all rock triangles that are never visible. What we measured is that it removes ~60-75% of the rock triangles in our arenas.

    It beats GPU Instancing by +300%, basically because cell based combining is already slightly faster but with only 1/3 of the original triangles to draw it's obvious whose the winner.

    Features:
    • Compatible with any rock Asset.
    • Compatible with Unity terrain, any Voxel terrain and terrain mesh solution.
    • Reduces draw calls by using cell-based combining
    • Much faster than GPU Instancing
    • Geometry reduction of ~60-80%
      • ~3x faster to render
      • ~3x less over draw on the GPU
      • ~3x cheaper shadows
      • ~3x reduced lightmap texture space needed (when using lightmapping)
      • ~3x reduced memory needed compared to Static Batching or Classic Combining
      • Cheaper colliders
    • Supports lightmapping
    • Supports LODs



    MCS Caves1.jpg
    MCS_Caves2.jpg
    MCS_Caves4.jpg
    MCS Caves & Overhangs6.JPG
    MCS Caves & Overhangs7.JPG

    MCS is used in our DRONE The Game which is Early Access on Steam:
    https://store.steampowered.com/app/987020/DRONE_The_Game/
     
    Last edited: Aug 31, 2020
  2. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    MCS_Caves5.jpg MCS_Caves6.jpg MCS_Caves7.jpg
     
    Last edited: Apr 18, 2019
  3. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    This is pretty awesome! -- I've been waiting a LONG time for something like this.

    Does this run without MCS? I ask because it seems like this should be a built-in feature!

    Also --

    What is the suggested workflow for working with streaming terrain (with a floating origin) when using something like World Streamer with MCS (and this)? -- Is this kind of use-case / workflow being considered?
     
  4. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes we were also thinking for quite some time how to solve this either use GPU instancing or remove the inside geometry. In our Arena Builder demo players were reporting performance issues when placing a lot of rocks together to make caves, floating islands, etc. Even someone put his GTX 1080 to it's knees with like 30 fps on a massive floating island made out of rocks. So we decided to try the geometry removal and now that we have the results we're glad we choose this path as performance and lightmapping results are great.

    It's an extension for MCS, so MCS is needed for it.

    WorldSteamer and MCS should work really well together, because WorldStreamer divides the world into Scene cells and MCS combines into cells. So e.g. if your Scene cell is 512, MCS cell size can be 16/32/64. So Scene cell size needs to be dividable by MCS cell size. The way to go would to optimize the rocks in Unity Editor and WorldStreamer will save/load the rocks with the Scenes.

    So basically just place all the rocks you want, do the few clicks with MCS to optimize them and WorldStreamer will take care of the rest. I have WorldStreamer and will look into the exact details.
     
    Last edited: Apr 24, 2019
  5. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Good news, got LODs working and will push it to the Asset Store tomorrow :)
     
    awesomedata likes this.
  6. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    That sounds great.

    Thanks for looking into this -- I'm really looking forward to learning how to use this asset with WorldStreamer!!


    Also, one other question -- will the Caves and Overhangs functionality increase filesize of the project by much?
     
  7. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Not that much, combining inside a Scene does increase it's size, but then the removal decreases the size needed x3. Also the reduced lightmap (when using lightmapping) texture space needed reduces the texture size needed, so when using lightmapping you actually would save file size quite a bit.

    Our arena Scene file that I show in the video is 43.7 MB, but the lightmap textures we use are 118 MB. So when not using it the Scene file would be a few MB, but ligthmap textures would be 118 * 3 = 355 MB with same quality results. So we actually save a lot.
     
    awesomedata likes this.
  8. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hey Everyone,

    Yesterday I submitted MCS Caves & Overhangs to the Asset Store.

    Also our artist made a new cave arena which I think looks stunning. I exchanged the screenshots ^.

    Nathaniel
     
  9. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    awesomedata and Quique-Martinez like this.
  10. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    191
    I was wanting to pick this up from the store but it has been deprecated for some reason. Was there issues with the package?
     
  11. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
  12. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    214
    I presume (hope) just like MCS, this can be used during runtime for my procedurally generate terrains?
     
    SickaGames1 likes this.
  13. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes it can be used at runtime, although it can take some time to run the removal depending on how much overlap. I can make it a lot faster if Unity fixes the Collider.Raycast bug with Physics.queriesHitBackfaces turned on (Physics.Raycast works fine, but is slower as I need the raycast only on 1 collider at the time). It doesn't work correctly. If you shoot a ray below a sphere it hits the back face on the top. I will do a bug report for this.
     
    blacksun666 likes this.
  14. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
  15. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    356
    I'm curious, this is called "caves & overhangs" and emphasizes caves, but isn't it just back-face culling and poly-removal from intersecting meshes?

    I need something to do that, but I don't have a bunch of (very pretty) cave assets, more a kitbash of sci-fi assets. Since this isn't free (any more), I'd like to know if this is what I think it is versus some specialty thing just for "caves" against terrain (I have none), before purchase.
     
  16. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes the extension is adding poly removal for intersecting meshes, MCS 2 has back-face and below terrain removal. It works on any meshes that are closed. So for other things it works as well, but what I could mostly think of the use-case to high-light this special feature is on using rocks to make or add detail to caves and overhangs. So basically you can make nice looking caves & overhangs with terrain and rocks and optimize it as best as possible.
     
    Last edited: May 7, 2019
  17. ooee

    ooee

    Joined:
    Jun 8, 2015
    Posts:
    5
    I purchased MCS Caves & Overhangs.
    I want to remove the overlapping tris in the same position, but it does not work well.

    Is it possible to remove tris when overlapping at the same position?
     

    Attached Files:

    twitchfactor likes this.
  18. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Definitely a good use-case. I'd use it that way.
     
  19. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    356
    That's exactly how my levels are constructed and that's what I was asking about "backface culling". From the author's answer, I determined it won't do squat for our type of construction. It sounds like it's only good for clipping against a terrain mesh. MCS has a sort of super-clunky backface culling, but... it's super clunky and requires a TON of specialized boxes all over. :(
     
  20. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    In the current version it's not working for vertices that are in the exact same position. MCS will only remove a triangle if it's inside another collider. However I know a way to solve it...I will release an update tomorrow that supports this feature request.
     
    Last edited: Aug 11, 2019
  21. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi as promised here's the update that allows to remove same position triangles (vertices). I also submitted it to the Asset Store.

    You just need to enable the new `remove same position triangles` and it should work:
    upload_2019-8-11_20-38-2.png

    Example:

    upload_2019-8-11_20-39-36.png

    Overdraw before combining:

    upload_2019-8-11_20-40-6.png

    Overdraw after combining:
    upload_2019-8-11_20-42-5.png

    That is a huge optimization ;)
     

    Attached Files:

    ssojyeti2, Weblox, gurayg and 2 others like this.
  22. ooee

    ooee

    Joined:
    Jun 8, 2015
    Posts:
    5
    This update is great!
    It worked well in my project.
    Thank you for the your update.
     

    Attached Files:

    awesomedata and hopeful like this.
  23. ooee

    ooee

    Joined:
    Jun 8, 2015
    Posts:
    5
    If the mesh model pivot is not the center of the model, "Remove Same Position Triangles" will not work well.
    Is it possible to work even if the mosh model pivot is not the center of the model?
     

    Attached Files:

  24. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yep it's possible. Can you check if it works correctly now?
     

    Attached Files:

  25. ooee

    ooee

    Joined:
    Jun 8, 2015
    Posts:
    5
    "MCS_remove_samePosition_triangles2.unitypackage" is same as "MCS_remove_samePosition_triangles.unitypackage".
     
  26. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    That is strange, seems that Unity doesn't detect the difference. Can you delete this script `CreateOverlapColliders`

    And try reimport version 2 again? The CreateOverlapColliders.cs should look like this on line 314:

    upload_2019-8-12_11-10-33.png
     
    Last edited: Aug 12, 2019
  27. ooee

    ooee

    Joined:
    Jun 8, 2015
    Posts:
    5
    I removed "CreateOverlapColliders.cs" and imported "MCS_remove_samePosition_triangles2.unitypackage".
    The CreateOverlapColliders.cs is like this.
    capture1.png

    Perhaps unity import package system in my development environment may not work well.

    Anyway, I added the above code and "Remove same position triangles" worked well.
    Thank you.
    capture2.png
    capture3.png
     
  28. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    I've got a couple of questions ---

    1) Does this grid thing still work if the edges don't collide 100% in the same position?
    For example, let's say I have amorphously-squared rock volumes that I lay around on a grid that actually go _over_ the size of a single standard grid square in all three dimensions. In a lot of places, they'd overlap, but around edges or as a wall or corner, some parts should be culled but not others. Would this remove those triangles that are overlapped?

    2) Also, how costly would this be in terms of hard-disk space at runtime or in the project (since most of these rocks would be instanced and _mostly_ identical in my project)? -- I'm worried that a new mesh would have to be created for all of these rock volumes and stored in the project indefinitely (despite them essentially being the same rock).
     
  29. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    1). Yes it would remove them, MCS removes triangles that are inside another mesh, for the same position overlap I added a slight scale up of the other mesh of 1mm to include if the vertex is on the surface of the mesh.

    2). Indeed combining adds to memory usage, but the geometry % you remove also makes the same % of less memory it uses compared to traditional combining. So if you remove 60% of geometry the mesh uses 60% less memory. How much that would be depends on how many vertices you use multiplied by memory usage per vertex. E.g. position (Vector3 = 12 bytes) + normals (Vector3 = 12 bytes) + tangents (Vector4 = 16 bytes) + uv (Vector2 = 8 bytes) = ~42 bytes per vertex. Also on disk this gets compressed by Unity (in the build).
     
    awesomedata likes this.
  30. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Indeed. I was mainly trying to figure out how well this approach might fare against just instancing the same meshes at runtime (and keeping the overdraw). I'd really like to have the best of both worlds since I'm using volumes of smaller repeated similarly sized meshes to make the world, but I'm not terribly sure how I might approach that with your setup to eliminate overdraw. Any ideas?
     
  31. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Can you show a screenshot of how it looks and one with wire-frame?
     
  32. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm trying MCS with the Cave add-on to remove tris from a bunch of cliff rock meshes that intersect the terrain. However, I'm having a little trouble with the mesh colliders. I need mesh colliders because the top surfaces of these cliff rocks are walkable. But:

    1) On some meshes, the MCS-generated mesh collider doesn't match the mesh render -- it's higher, and so the player-character walks about a meter above the mesh surface. Very odd, and only happens with some meshes. Any idea what could be going on there?

    2) On my original prefabs, I have a mesh collider on LOD0 and box colliders on other LODs (necessary for NPC collision detection). But MCS puts mesh colliders on all LODs. Is there a way for MCS to transfer the colliders that I've set up?

    thx
    Dave
     
  33. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    1) Can you DM me the mesh on which it happens? I didn't have this issue so far.
    2) That must be a bug, will look into fixing it.

    If you disable the `Add MeshColliders` option, which leaves the original colliders intact, does it work then?
     
  34. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    upload_2019-8-13_17-16-24.png

    upload_2019-8-13_17-14-42.png

    upload_2019-8-13_17-19-30.png

    This is basically the idea. That one rock is repeated. The instances inside the box would be removed.
     
  35. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    It will work with MCS. How many vertices and triangles does your rock mesh have? It looks a bit expensive, probably best to use Lods for it.

    The other option would be to use instancing and have each rock face as a separate instance. In both cases you could have more variations to break the tiling. MCS will always be faster, but will use more memory so you have to evaluate if the memory usage is acceptable. Another possibility to use less memory would be to use normal cubes with MCS and use distance based tessellation on them with a displacement map.
     
  36. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    I've just purchased the MCS Cages and Overhangs addon and am taking it for a spin. One thing I've noticed is that the licensing info in the downloaded package is different from that on the Asset Store. I assume the license file in the package needs an update?

    Also, MCS itself and the Caves & Overhangs add on package have different licenses on the Asset Store itself. Is that deliberate?

    In any case, I just pointed MCS at one of my outdoor island scenes and am pretty excited by the results. For what it's worth, I'd pay far more than the asking price for this.
     
  37. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks for the purchase. Can you show me some screenshots of what you mean? I don't get a license file when importing the package.
     
  38. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    Just PM'd you. Don't need them cluttering up this thread!
     
  39. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Ah yes I forgot to update the readme. Thanks for telling, I will fix it for the next update.
     
    angrypenguin likes this.
  40. RemitPrime

    RemitPrime

    Joined:
    Apr 20, 2016
    Posts:
    23
    Hello,

    can you link the rocks used in the video ? you said they are from asset store.

    Thank you.

     
  41. yuriiradkevych

    yuriiradkevych

    Joined:
    Feb 5, 2017
    Posts:
    1
    I would like to refund.
     
  42. Blade_Master_2020

    Blade_Master_2020

    Joined:
    Aug 3, 2019
    Posts:
    38
    I have some questions:

    1. I’m making a voxel game which allows players to dig holes into terrains(like making a basement underground ). I wanna ask if MCS caves really dig a hole on the terrain that allows players walk into it? I mean dig a real hole by changing the terrains , not only place many stacked rocks on the terrain surface.

    2.If players remove the bottom of a overhang to make a floating island/debris , can these debris fall to the ground automatically? I really need this feature to make my game more realistic.

    Best regards.
     
  43. xDeveloper

    xDeveloper

    Joined:
    Sep 27, 2015
    Posts:
    10
    Any news?
     
  44. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I released these updates on the Asset Store recently, including that option:

    MCS Caves & Overhangs

    Version 1.22
    * Fixed removal issue when Physics.autoSyncTransforms is disabled.

    Version 1.21
    * Original collider deactivation fix

    Version 1.2
    * Remove same position triangles. E.g. will remove insides of cubes that are snapped together.
    * Removal of overlapping triangles more accurate.

    Version 1.1
    * Fixed error when 2 vertices on the same position.
     
    Weblox likes this.
  45. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi Everyone!



    I finished my new Debugging Essentials asset and it's pending now on the Asset Store (was already accepted so shouldn't take long).

    Check out the video, it's very generic and can be used in any project. I'm using it all the time to speed up development, I even used it on the Asset itself to quickly solve bugs, etc.
     
    Weblox likes this.
  46. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
  47. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hey Everyone,



    Debugging Essentials just got accepted on the Asset Store :)
    http://u3d.as/1UQB
     
    Weblox likes this.
  48. yeagob

    yeagob

    Joined:
    Jan 27, 2014
    Posts:
    18
    Hi! Mesh Combine Studio works in runtime?

    Edit: ok im using it on runtime, but Remove Overlapping Tris is not working well for my mesh, first is veery slow, but more important: destroy the mesh. Idont know what to do, can you help me? I send you captures of my configuration:

    Original object:



    After Combining:



    Settings 1:


    Settings 2:


    You can donwload the object to combine, if you wont to test it, in this link: https://drive.google.com/file/d/1XyJS1nE9vBrnSpdcC6ojh_l3Gdq8aT6L/view?usp=sharing
     
    Last edited: Jun 27, 2021
  49. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    A couple things off the top of my head:
    1) Do either of your Free Layers (overlap1 and overlap2) have colliders on them? That can cause problems
    2) Do you have more than 1 instance of the MeshCombineStudio prefab in the scene? That can cause what you are seeing if they overlap.

    I will download the object to combine and try it out on my end.

    Thanks!
     
  50. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    OK, I am looking at your object:
    1) It is way too small when imported into Unity - everything fits into a single cell and MCS cannot efficiently work with that
    2) The individual rocks are already merged into 3 separate meshes

    So, I did this:
    1) Brought it into blender and scaled the 3 meshes up by 1000 (maybe just 100 would have been fine)
    2) Again in blender, split each mesh by loose parts (if you are using blender and don't know how to do that, see https://wiki.nexusmods.com/index.php/Splitting_meshes_in_Blender)
    3) Saved it as an FBX and imported into unity

    Now, when using MCS in the editor, combining is very fast, see the attached image

    EDIT: Also I noticed the normals are flipped when I imported the original object into Unity, so there appears to be an issue with the normals in the original .FBX - after recalculating the normals in blender before exporting the new FBX combined correctly.
     

    Attached Files:

    Last edited: Jul 2, 2021