Search Unity

[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,704
    MCS switches the LOD for the entire cell. Otherwise the meshes would need to be recombined which gives considerable CPU and GPU overhead, which would defeat the purpose of the performance gain. In your example you need more cells, so instead of 1 cells, 9 cells and it would work almost the same. Also LOD switching for an entire cell gives less LOD popping and looks better.

    Nathaniel
     
  2. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    EDIT: Ignore the following, I just went through this thread and ran the updates along the way and it now works after 1.0.2 I believe

    Hi there - just purchased and for the life of me, I cannot get this to work.

    I have a pretty simple scene with a ton of meshes all under a single parent game object. The meshes are set to static (for lightmapping) but I disabled staticbatching in the player settings. My Mesh Combiner settings are as follows

    Draw Gizmos: on
    Show Cell Grid: all
    Search Box Square: off
    Parent: the parent game object for all my meshes
    Layer Mask: Everything
    Use Tag: off
    Only Static: off
    Use Vertex Input Limit: off
    Name Contains: off

    Cell Size: 32
    Lod Amount: 1
    Add Mesh Colliders: off
    Use Vertex Output Limit: off

    Combine in Runtime: on
    Combine on Start: on
    Use Combine Swap Key: on
    Combine Swap Key: Tab
    Original Objects: Disable Renderers
    Original Objects LOD Group: Disable

    Whenever we click Search, we get this:

    No matching GameObjects with LOD 0 'Search Options' are found for combining.
    UnityEngine.Debug:Log(Object)
    MeshCombineStudio.MeshCombiner:AddTransforms(Transform[], Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:505)
    MeshCombineStudio.MeshCombiner:AddObjects(Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:436)
    MeshCombineStudio.MeshCombiner:AddToOctree() (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:232)
    MeshCombineStudio.MeshCombinerEditor:OnInspectorGUI() (at Assets/Plugins/MeshCombineStudio/Editor/MeshCombinerEditor.cs:95)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  3. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    OK well now that I have it working, some results are in order

    (this is just by adding the prefab to my scene and setting one property)

    Disabled: 5400 batches, 119FPS, 103 set pass



    Enabled: 700 batches, 196FPS, 87 Set pass

     
  4. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    OK so I really need to know what the best process is for realtime dynamic GI. Is it possible to bake the scene using the original meshes and let this tool do its work at runtime? I really would love to avoid editor baking (mesh) because that is disruptive to my workflow, but realtime GI is a requirement so I would love to know what you recommend to get this working. Thanks! Love the product!
     
    SirTwistedStorm likes this.
  5. matteumayo

    matteumayo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Thanks so much for the fast support! Your solution works perfectly and I have to say the performance of this asset is incredible.

    I do have a couple questions, though:

    Are there any issues related to high Cell Size? I have a scene with lots of large meshes, for example, where performance is only improved with cell size 128 and up. I understand this can cause some LOD issues, as per your above post, but that's not a problem for me in this use case.

    Also one minor thing: when I change the color of a single object's material (via Material Property Blocks with the method seen here http://thomasmountainborn.com/2016/05/25/materialpropertyblocks/ ) the changed color is reverted after enabling MCS. For example, I have buildings with street signs that have their colors changed with this method after being procedurally spawned, then I enable MCS, and the signs are all turned white.

    My current solution is to simply ignore the signs with MCS, but I was just curious to know if there was something else I could do, or if this is a (understandable) limitation of MCS. My band-aid solution presents other problems, since changing the color of a single object in runtime is very powerful when procedurally creating environments - this ability would now be hampered.

    Thanks.
     
  6. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I did a test with your Barak mesh, and on my side it works good. One issue on the prefab is that each GameObject has a LODGroup component which needs to be deleted. Maybe that causes an issue...I need to see screenshots of your setup to see what would be wrong.

    Here is a test build:
    https://www.dropbox.com/s/gplcn372mdqpj85/TestBarackDemo.zip?dl=0

    I get 22 fps without MCS, and 370 fps with MCS. A performance increase of 1680% :)

    Also I included a console in this build to change the cell size to find the sweet spot where performance is best. Will include it with the next update.

    Nathaniel
     
    Quique-Martinez likes this.
  7. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I will look into this tomorrow if it's possible that combined meshes copy the GI from the original ones.

    No there's not really an issue with large cells, it's a matter of finding the sweet spot where a cell size gives you the overall best performance. LOD switching wouldn't be an issue.

    The thing about Material Property Blocks is that you can choose a separate one for each Renderer. So if you combine meshes with the same material into 1 renderer which basically MCS does than only 1 color can be changed for this combined object. So in this case you need to exclude these objects from combining, as it's basically dynamic.

    EDIT: If you use very small objects too you can use 2 instances of MCS, one for the big objects with a large cell size, and one for the small objects with a small cell size.

    Nathaniel
     
    Last edited: Oct 31, 2017
    matteumayo likes this.
  8. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    Thank you so much.

    This system is very promising and I'm lucky because I'm in the middle of building an open world game and I just dropped this in and had better results than I did with Mesh Baker or Static + Dynamic batching. It's a good day to be a Unity developer!
     
  9. cjoo

    cjoo

    Joined:
    Nov 16, 2016
    Posts:
    46
    Hello , this asset is usefull for optimizing performance for a MMO game ( without use occlusion culling )
    Thx :)
     
  10. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes for anything that involves static meshes, MCS can boost performance. MCS works best with meshes from 3 to about 5000 vertices (needs a bit more testing to find the ideal max limit). So if you use e.g. rocks, props, modular systems, etc, MCS can boost performance a lot.

    Nathaniel
     
  11. artysta

    artysta

    Joined:
    Nov 15, 2009
    Posts:
    124
    I tried it today and I liked the way it worked until I rebuilt my lightmaps and it went from 6.3MB to 96.8MB. So I had to pass. Nothing I seemed to change made a difference. I cant add 90MB to my lightmaps.
     
  12. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    That is strange indeed and shouldn't happen. Can you share your lightmap settings and show some screenshots of your setup?

    Nathaniel
     
  13. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    124
    Wow!! Its amazing!!!! I'm getting 130 vs16. The console idea s great as well. I'll repeat all steps to see if I'm missing something.
     
  14. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    43
    Hello,

    How to uncombined the combined game objects ?
     
  15. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    They cannot be uncombined. Best is to keep the original GameObjects in your Scene and re-combine if you modify them.

    Nathaniel
     
  16. cjoo

    cjoo

    Joined:
    Nov 16, 2016
    Posts:
    46
    Can i use it without LOD ? ^^'
     
  17. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes you can.

    Nathaniel
     
  18. cjoo

    cjoo

    Joined:
    Nov 16, 2016
    Posts:
    46
    So why , when i put my model prefab on "parent" and then i press "search" i have this debug message : No matching GameObjects with LOD 0 'Search Options' are found for combining.

    ?
    Thanks you :)
     
  19. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It means that no object meets the search conditions. Can you show a screenshot of your Unity window with MCS inspector?

    Nathaniel
     
    Last edited: Oct 31, 2017
  20. cjoo

    cjoo

    Joined:
    Nov 16, 2016
    Posts:
    46
    I have tried with "only static" enable (and disable from unity ) but same error message appear ...
    Thx !
     

    Attached Files:

  21. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    I tested this tool great tool to use. I suggest to anyone making a game, should buy this tool..... sadly I no longer can buy assets on the store, other wise I would be all over it as I OWN all of NATH's tool and tested many of them..... great tool and great developer... Not just saying this , I tried it in my new Steam game, and worked great...... But I did get some friends to buy the tool, and will let others know its a great tool to buy.....

    I'm sadden I can't buy the tool. so this is my way of supporting it:) 22 bucks is nothing for a tool like this, once it gets atlas, and substance support, it will be even better.
     
  22. artysta

    artysta

    Joined:
    Nov 15, 2009
    Posts:
    124
    All my lights are simple Point lights which are baked into the lightmaps,
    with 1 real time directional light (sun source) I have 6 scenes in the project all are between 5-7MB Lightmaps each, but if I re-generate the lightmaps after all my static meshes are combined, they go up to 90-110MB each.
    This is a large mobile game so that doesn't work. I would go from 30mb to over 600mb.
    Screen Shot 2017-10-31 at 11.55.00 AM.png
     
  23. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It's not an error, it just means that no meshes are found. You put in the search parent your 'Cliff_Formation_01' GameObject, this GameObject is empty, it doesn't contain the meshes we can see in the Scene. You need to assign the GameObject that contains your meshes.

    Hi Recon, Thanks for recommending MCS :)

    Nathaniel
     
    twobob likes this.
  24. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It must be that the lightmap scale is bigger on the combined objects, so basically the combined objects are baked with higher resolution. This would need to be the same scale of the original meshes. I will look into a fix for this.

    Nathaniel
     
  25. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I researched today if lightmapping can be preserved, but this is not really possible. It's explained in this post by Ben an Unity dev:
    https://forum.unity.com/threads/imp...garding-mesh-uv-channels.370746/#post-2402508

    So lightmapping and GI would need to be re-baked on combined meshes. Do you also have an increase in lightmap size on disk like Artysta?

    Nathaniel
     
    PutridEx likes this.
  26. artysta

    artysta

    Joined:
    Nov 15, 2009
    Posts:
    124
    Thanks, I look forward to it. I've used other mesh combine tools, like the way this is working.
     
  27. claudius_I

    claudius_I

    Joined:
    May 28, 2017
    Posts:
    186
    Hi
    I have a problem with combined LOD (My FPS are lower that when MCS is deactivated).
    And a have a problem with textures (i think 2 LOD are load at the same time)
     

    Attached Files:

    • lod.jpg
      lod.jpg
      File size:
      15.3 KB
      Views:
      508
  28. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    IGNORE - I'm an idiot and figured it out. Just uncheck the "combine at runtime" box and the button becomes visible.

    Thanks Nathaniel - is there an editor GUI yet to combine the meshes or do we have to make our own editor script and call the API?
     
  29. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    Oh and I am using realtime GI and the LightingData seems to be around the same size however the quality of the bake seems to be reduced when baking combined meshes vs. the original ones. I get lots of shadow acne etc.
     
  30. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes that must be the case. I'm working on the feature that the amount of LOD levels are detected automatically. With the current version you need to separate all LODs and combine them separately. So put all meshes with 2 lods in a separate parent, with 3 lods in another separate parent, etc. And use a separate MCS instance on each.

    I'm working on this feature and will be implemented with the next update, so it will be just click -> done.

    Yes you can combine in the Editor and rebake the GI/Lightmapping. All you need to do is deactivate the runtime, and click 'Search' and then click 'Combine'. Or do you mean combining meshes manually? For that you just need to put them in a parent, assign this parent to 'Search Parent' and put cell size and click 'Search' -> 'Combine'.

    Nathaniel
     
    Last edited: Nov 4, 2017
  31. roxIndie

    roxIndie

    Joined:
    Oct 14, 2012
    Posts:
    27
    Excellent asset! This is really awesome for everything runtime generated :D
     
  32. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    during beta I had said atlas is a must for sure.:)
     
    hopeful likes this.
  33. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    847
    Hi, this looks very promising!
    I'm thinking, can I use this system at same time specify every original gameobject by their colliders?
    Like I'm having 10 thousand small stones in the scene and each has a collider and a script for me to detect and pick it up.
    Can I keep he function with this system on?
    And, can this system handle trees or terrain tiles?
     
  34. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes if you choose the option to combine at runtime, you can still access the original GameObject with their collider, scripts, etc. MCS will just disable the MeshRenderer for it.
    Objects in combined state are static though, what exactly are you doing with the script on the stones? Is it for mining? Currently I'm working on an update with multi-threaded combining which basically allows to combine and re-combine at runtime. So e.g. if you remove a stone, it will be possible.

    If they are static custom trees like poly trees, yes. But SpeedTrees not as they have their own shaders which don't work correctly when combining, best is to use vegetation studio for this. Also Unity's terrain system already uses combined and lod meshes.

    Nathaniel
     
    Last edited: Nov 2, 2017
    matteumayo likes this.
  35. Stanton560

    Stanton560

    Joined:
    Aug 21, 2017
    Posts:
    14
    What's my next step? Seems the shader isn't supported, which seems to increase draw calls.

    Could not create a custom UI for the shader 'FlamingSands/Nature/PBR Metallic Tree Masked wind AO'. The shader has the following: 'CustomEditor = ASEMaterialInspector'. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
     
  36. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    This error is unrelated to MCS. What are you trying to do with MCS? Can you show some screenshots of your setup?

    Nathaniel
     
  37. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Hi. :) Is this asset unity 2017.2 compatible?
     
  38. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    33
    I am using it just fine in 2017.2 yes
     
  39. Stanton560

    Stanton560

    Joined:
    Aug 21, 2017
    Posts:
    14
    Apologies Nathaniel, I see that it isn't the same issue.

    I am trying to figure out why the shaders seem to stop working and the drawcalls increase. This is a package I bought on the asset store.

    Regular.

    regular.png

    MCS

    mcs.png
     
  40. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes it is. The next update will be compatible with Unity 5.0 and up (while currently need at 5.5 and up for it).

    Nathaniel
     
  41. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Nathaniel , cain06, Thanks!
    AWESOME!!!:):):):):):):):):):)
     
  42. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I wrote you a personal message, we can see that with MCS the Vert count goes from 792.4K to 3.9M (it shouldn't increase) so that's why you don't see any improvement as there's more then 4x more geometry rendered. So something is wrong with the setup, the whole Scene seems to be rendering 4x.

    Nathaniel
     
  43. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,063
    I need light map support
    and creation of texture atlas support
    :) thanks
     
  44. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Lightmap support is already in there. You need to combine the meshes in Unity Editor and mark them as static and rebake the lightmap. Copying the lightmap information is currently not possible as explained in this post by Unity:
    https://forum.unity.com/threads/imp...garding-mesh-uv-channels.370746/#post-2402508

    Texture atlassing is on the roadmap ;)

    Nathaniel
     
  45. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Should I delete the old objects after I have combined the meshes and it made their duplicates? I am also getting this error when I hit Combine

    Code (CSharp):
    1. Mesh.uv2 is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
    2. UnityEngine.Mesh:SetUVs(Int32, List`1)
    3. MeshCombineStudio.MeshCombiner:CreateMesh(Transform, Transform, SingleMeshes, Vector3, Int32, Boolean, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:678)
    4. MeshCombineStudio.MeshCombiner:CombineMeshes(SingleMeshes, Vector3) (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:524)
    5. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:185)
    6. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    7. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    8. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    9. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    10. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    11. MeshCombineStudio.Cell:CombineMeshes(MeshCombiner, Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Octree/ObjectOctree.cs:192)
    12. MeshCombineStudio.MeshCombiner:Combine(Int32) (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:415)
    13. MeshCombineStudio.MeshCombiner:CombineLods() (at Assets/Plugins/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:367)
    14. MeshCombineStudio.MeshCombinerEditor:OnInspectorGUI() (at Assets/Plugins/MeshCombineStudio/Editor/MeshCombinerEditor.cs:110)
    15. UnityEditor.DockArea:OnGUI()
    16.  
     
  46. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I posted a fix for this here:
    https://forum.unity.com/threads/mesh-combine-studio-boost-performance.501543/#post-3270146

    You don't have to delete the old GameObjects in case you want to move them around and recombine them, you can deactivate them.

    Nathaniel
     
  47. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    I am going to give it a try, also I am using TerrainComposer for the terrain and trees, and what would you recommend if I want to combine the trees?

    My old game objects won't move, they are houses and fences.
     
  48. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    After updating, the component looks like this and I don't see the gizmos, also once I hit Combine, I get this message

     
  49. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    As for trees if they are SpeedTrees I recommend to use Vegetation Studio, explained in the post above:
    https://forum.unity.com/threads/mesh-combine-studio-boost-performance.501543/page-2#post-3274204
    It means that no objects are found. Can you show a screenshot of your Hierarchy window included?

    Nathaniel
     
  50. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    They are just the same objects I used before I installed that update. I also tried make a new game object that holds a few cubes, assigned it as "Parent" and still the same message appears. I will try to delete the whole plugin and import it again.

    Did they release Vegetation Studio?
     
    Last edited: Nov 4, 2017
unityunity