Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Mesh Combine Studio 2 (Boost Performance)

Discussion in 'Assets and Asset Store' started by eagle555, Oct 24, 2017.

  1. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Good question. As far as I understand, you can use the URP batcher on top of MCS2 combining because URP batcher optimizes how Material changes (SetPass calls) are processed on the CPU and being submitted to the GPU.
     
  2. yeagob

    yeagob

    Joined:
    Jan 27, 2014
    Posts:
    18
    Hello, we can not find more than one mesh. We want to combine 2 meshes (a lot more, but first this two), but no matther what option i choose, your system only found one mesh...

    What can we do??

    upload_2020-12-22_18-46-23.png
     
  3. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi, I see you asked the same question on my Discord server. I answered you there...
     
  4. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Hi, I´m trying and use your asset in my game, but, so far, using it only resulted in a DROP in the frame rate, actually, it´s dropping my FPS in HALF

    It´s happening EVEN using the example scenes

    I´m using URP, perhaps it does have smowthing to do with it?

    Thanks for your attention
     
  5. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Update

    I updated the materials in your examples to URP compatible ones and now your examples work

    But My scene is still dropping framerate...

    But not all of your scenes, for example:

    shadow combining have a MUCH higher frame rate with no combining at all

    and Static example also works somewhat better with MCS disabled.
     
  6. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi thanks for contacting and reporting this. That is strange. Which Unity version are you using? It could be caused by the Unity Editor. Have you tried testing in a build?
     
  7. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Hi

    No, not in build, I´m using 2019.4.15f1

    I tried atlasing the objects but it also did not help improve performance...

    and, actually, atlasing the objects actually also impacted negativelly the frame rate, so, perhaps (probably) it´s something wrong on my side.

    I´ll make a few more tests

    thanks for your help
     
  8. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks for testing. Can you test the example Scenes in a build? Are they also slower combined?
     
  9. yeagob

    yeagob

    Joined:
    Jan 27, 2014
    Posts:
    18
    Please, we are wating for more than 10 days, can you answer here or by Discord???

    I dont want to put a bad comment in your asset, but is not working at all...
     
  10. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi, sorry for the delay. The Earth2 project I'm working on went viral. However I'm fully back with support now and try to answer very fast like I used to do. I answered you on Discord.
     
  11. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,910
    There's an error in 2.993 when trying to combine with default settings.

    Code (csharp):
    1. (MeshCombineStudio) => The `Custom Combined GameObject` is null. Make sure it's assigned in the 'Use Custom Combine GameObject` setting
     
  12. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks for reporting. You have the `Use Custom Combine GameObject` enabled:
    upload_2021-1-19_12-29-47.png

    Then you need to make sure that is assigned or you need to disable that option.
     
  13. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,910
    It happens when it's disabled.
     
  14. FaberVi

    FaberVi

    Joined:
    Nov 11, 2014
    Posts:
    146
    Hi, I'm trying to merge about 10,000 trees into a scene with a cell size of 50. The merge is successful, but when I try to start the Unity scene it gives me an error due to the excessive weight of the scene. If I try to save, the scene weighs 8GB and gets corrupted. Where am I doing wrong? The number of trees cannot be reduced.

    Serialized file size of 8.28 GB (8892665443 bytes) exceeds maximum. File name: 'Assets/_Scenes/Main.unity'. Serialized files over 4.00 GB (4294967295 bytes) cannot be loaded by the player. Some likely ways to reduce this are utilizing asset bundles, re-balancing asset locations, or limiting their serialized size e.g. limiting the maximum texture sizes.
     
  15. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Found a problem with MC2, when i bring it into a project, the project starts reimporting ALL ASSETS in the project.
    I have tested extensively on multiple assets, and MC2 is one of the assets calling a update/reimport when installed.

    Also tested by importing other assets before, no reimport, but after MC2 is added everytime i import something it calls this update..

    Also when clicking the "Make meshes readable" it then again reimports assets.. :(

    Please disable this, it's not good.


    upload_2021-4-6_9-41-10.png
     
  16. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    This is Unity performing the reimport for assets that were altered.

    As far as I understand it, MCS only changes the assets for you. I'm not sure if there is a way to make Unity's reimport distinguish between mesh assets (there should be a way, but this is Unity we're talking about here), however the only way an asset can set something on existing assets in newer versions of Unity is by changing the setting and telling Unity that it needs to reimport all assets that were changed (i.e. the assets that have that particular "readable" flag).

    There may be more to it since Asset Databases, DOTS, etc., (I'm not as familiar with this as I need to be since DOTS was introduced), but I hope this helps clarify some of the default behavior behind things.

    One thing that could (always) help is specifying what version of Unity you're working with.
    I'm not the asset author, but a lot changes between versions, so I know how helpful that can be. Just my two-cents.
     
  17. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks for reporting. That's very strange, which Unity version are you using?
     
  18. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hi, thanks for reporting. That's probably because your trees are heavy meshes and combining them takes a lot of memory. For trees in general it's better to use GPU instancing.
     
    julianr likes this.
  19. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    It might be nice to give a little insight about when MeshCombineStudio is better versus GPU Instancing, as the use-cases are pretty vague for most people it seems.

    i.e. How 'heavy' are we talking before our performance benefits (MCS vs. GPU instancing) outweigh our memory cost?

    Clearly this is game-specific, but some guidelines could be pretty useful.
     
  20. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Sorry about that, 2020LTS..
     
  21. Venominus

    Venominus

    Joined:
    Sep 5, 2015
    Posts:
    25
    mesh combine stays in memory and with each loading of scene takes more and more memory and after several loading application runs out of allcoatable memory. meshcombinestudio.meshobject and meshcombinestudio.cachedgameobject first load 30 mb second load of scene 60 mb etc. Mesh combine isn't dontdestroyonload.
     

    Attached Files:

  22. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    69
    hello, I used the static LOD group demo scene to replace the chair prefab to my own rock prefab, but it keeps complaining that's Read/Write is disabled. Pressing the red button did not help. But the model has already have the read/write enabled. Any idea? thx.
    upload_2021-4-24_12-40-59.png
    upload_2021-4-24_12-41-5.png
     
  23. TFGCo2

    TFGCo2

    Joined:
    Jun 10, 2017
    Posts:
    2
    Hey guys, i dont know if i'm missing something but i cant build the game, the assets seems to work on the scenes but everytime i try to build i got a lot of errtors but all very similar like tghis one Assets\MeshCombineStudio\Editor\CombinedLODManagerEditor.cs(9,45): error CS0246: The type or namespace name 'Editor' could not be found (are you missing a using directive or an assembly reference?)
     
  24. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    do you have compile errors on any other scripts? As it may not be MeshCombineStudio, it just means it might not be able to compile from that point.
     
  25. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Hi hauwing, are you still having problems with this? What version of unity and what rendering pipeline are you using?
     
    twobob likes this.
  26. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    69
    I changed to not to combine in runtime and the problem is resolved (kind of)...
     
  27. Drown

    Drown

    Joined:
    Feb 5, 2017
    Posts:
    11
    Great job, developer seems to be MIA again...

    Edit : Sorry, did not see that there was a new person maintaining this thread. Great to see this asset being supported :)
     
    Last edited: Jul 1, 2021
    JJ-Jabb likes this.
  28. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Hi Drown, I'm here working support... is there something I can help with?
     
  29. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    I haven't been able to reproduce this behavior - if you want to send me an model (FBX or OBJ) that is causing this problem I can take a look
     
  30. SBliznitsov

    SBliznitsov

    Joined:
    Mar 13, 2019
    Posts:
    17
    Hello.
    I get the error: "Mesh doesn't have a ModelImporter and is a mesh.asset, it's tricky to make readable."
    I have enabled the Read/Write manually in the model importer but the error remained.
    Does anyone know how to solve this problem?
    I will be grateful for any help!
     
  31. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    We spoke on Discord - we can continue discussing there or here, whichever is more convenient for you
     
  32. SBliznitsov

    SBliznitsov

    Joined:
    Mar 13, 2019
    Posts:
    17
    Your answer on Discord helped solve the problem. Thanks for the help!
     
  33. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Hello

    I succesfully combined all the static objects in my game, it solved, at least, the problem I was having with the device overheating...

    But, I´m having a hard time to figure out how to combine the dynamic objects (everything else)

    I created an empty object named "pools" (using PoolManager to spawn game objects and reuse it)

    Created a new MeshCombineStudio and directed it to this empty object and set it to "combine per frame"

    I thought it would make a search per frame and combine objects, but it does nothing

    If I manually search and combine it does find some other objects, should I do it this way? not sure if it´s feasible...

    anyway, what´s the best way to combine objects as they are spawned?

    thanks in advance!
     
  34. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Have you looked at the "Dynamic Object Example" scene under Assets/MeshCombineStudio/TestScenes? Take a look at the settings there, that might be a good starting point. If you are still having problems let me know, either here or on Discord at https://discord.gg/HhepjD9
     
  35. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Hello

    Yes, I tried, but I just found the problem...

    skinned meshes...

    that´s why it wasn´t finding anything...
     
    JJ-Jabb likes this.
  36. dfarjoun

    dfarjoun

    Joined:
    Aug 6, 2017
    Posts:
    42
    Hi,
    Any idea why I keep getting scripts errors when trying to install from Package Manager?

    I've even already deleted the Library folder and keep getting this install errors:

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs(253,17): error CS0103: The name 'CreateOverlapColliders' does not exist in the current context

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs(457,17): error CS0103: The name 'CreateOverlapColliders' does not exist in the current context

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs(636,13): error CS0103: The name 'RemoveOverlappingTris' does not exist in the current context

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs(652,21): error CS0103: The name 'CreateOverlapColliders' does not exist in the current context

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs(653,22): error CS0103: The name 'CreateOverlapColliders' does not exist in the current context

    Assets/MeshCombineStudio/Scripts/Mesh/MeshCombineJobManager.cs(1261,21): error CS0103: The name 'RemoveOverlappingTris' does not exist in the current context
     
  37. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    I can't using the namespace of MeshCombineStudio, I know it is about somethingscript compilation order, What can I do to refer meshcombiner?
     
  38. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Looks like a bad import (?) - try deleting the MeshCombinStudio directory and try again
     
  39. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
  40. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    I need more information - I'm not seeing any issues using the MeshCombineStudio namespace in either a monobehavior or a custom Editor in an Editor folder.
     
  41. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Yes, MCS works with Digger Pro - for example, here are screenshots before using MCS, both above and below the terrain:
    upload_2021-10-28_10-17-20.png
    upload_2021-10-28_10-18-17.png

    and here is after:
    upload_2021-10-28_10-19-8.png
    upload_2021-10-28_10-19-42.png
     

    Attached Files:

  42. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Great, thank you! And that would work as expected if the building were under the terrain itself, but inside a Digger mesh—only the part of the building that's outside the Digger mesh chunks would be culled?
     
  43. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    You will also need the MCS Caves & Overhangs addon to remove intersections with the Digger mesh - for example, here's before
    EDIT: ACTUALLY I don't thing MCS Caves & Overhangs works with Digger - These screenshots are all using Remove Tris Below Surface, I tried with just the Remove Overlapping Tris and the removal was minimal
    upload_2021-10-28_12-47-32.png
    upload_2021-10-28_12-47-55.png

    and here's after, with both "Remove Tris Below Surface" and the MCS Caves&Overhangs option "Remove Overlapping Tris"

    upload_2021-10-28_12-50-34.png
    upload_2021-10-28_12-51-3.png
    upload_2021-10-28_12-51-34.png
     
    Last edited: Oct 28, 2021
  44. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    OK a couple more screenshots - these JUST use "Remove Tris Below Surface".

    Before:
    upload_2021-10-28_13-4-1.png

    After:
    upload_2021-10-28_13-4-20.png

    upload_2021-10-28_13-4-40.png
    upload_2021-10-28_13-4-58.png


    Your results may vary depending on your meshes and use case, but over all it works pretty well out-of-the-box
     
  45. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Thanks for the detailed reply! That's helpful, but none of those images quite address the use case I'm talking about, I think—I tried to put some images together to better illustrate:
    mcstest1.PNG

    mcstest2.PNG

    In these images, the blue plane is a Unity terrain, and the red tunnel is a Digger mesh. There is a rock in the Digger tunnel—the rock is totally beneath the heightmap of the Unity terrain and partially clips into the bottom of the Digger tunnel.

    If I were to use "Remove tris beneath surface" on the blue terrain (to clean up all the rocks, buildings, etc. I have in my world that clip into the terrain), would that entire boulder be removed? Or would MCS recognize that the top half of the boulder is 'in the open' and only prune the tris that clip beneath the Digger mesh?

    Sorry to be so exacting about this, but using Digger caves beneath terrain are a big part of my workflow, so I just want to be sure!
     
  46. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Since I try to edit other asset script to add MCS function, but that asset already have Assembly Definitions and Assembly References, it make that asset script can't reference MCS namespace. I know it isn't normal case, but in case we need to work with difference asset, I better find the solution.
     
  47. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    That doesn't sound like an issue specific to MCS, that sounds like an overall assembly dependency issue.

    You could try creating an assembly definition for MCS and then include that in your other asset, but this is going to be an issue with any assembly definition where you want to reference namespaces in Assembly-CSharp - it can't be done that way, you'll need to move the code you want to reference into an assembly and then reference that assembly
     
  48. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    Ah, OK I see. Unfortunately that doesn't work so well - it won't correctly remove triangles in that situation.
     
    gewl likes this.
  49. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Will this asset work with/provide benefits with ECS/DOTS and the Hybrid Renderer V2?

    Is that even a sensible question to ask? Just so you know the level of experience you are dealing with here...
     
  50. JJ-Jabb

    JJ-Jabb

    Joined:
    Feb 6, 2015
    Posts:
    42
    At this point MCS does not work out-of-the-box with ECS/DOTS. However I'm hoping to have some proof-of-concept work done soon, so it's on the roadmap.