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
    Maybe the layer mask is set to nothing? Try to enable 'Use layermask' to see it. I didn't include the if check if it's enabled or not, so layermask is always checked. In the next update this will be fixed.

    Nathaniel
     
  2. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Oh yeah, this was the issue. It was exposed in the first version and now I had to check it in order to use it. One more question is - if I have NPCs that are not static and are constantly moving around, should I combine them as well? I guess I will have to use another MCS prefab just for the npcs, if it's somehow possible to combine them, because they have tons of scripts and AI.
     
  3. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    You can use MCS to combine a dynamic object, but you need to keep in mind all the parts that would need to move/rotate related to the dynamic object. Combined means it becomes one mesh, so you won't be able to transform the separate parts, but only as a whole.

    Nathaniel
     
  4. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Okay, so basically when Im done combing the object I should disable the mesh renderer of my previous object and leave the custom colliders enabled only? Also I noticed a problem with some of the LODs I have, I deleted the LOD Group component and rebaked but it's not working, LOD amount is set to 1, if I increase it I get an Argument Out Of Range Exception, does it have to be equal to all of the LODs that I have in the objects Im combining?

    Did you manage to figure out the lighting issue? The combined objects are not set to static and if I manually set them to static and rebake the lights, they look really bad. I have only one directional light set to Mixed. This is an example of a house roof from the Village Kit asset, after rebaking

     
    Last edited: Nov 4, 2017
  5. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    If you want to use lightmapping you need to indeed combine in Unity Editor. Yes and then you should disable the old GameObjects and keep the colliders intact. I have this feature to disabling old GameObject automatically for runtime, will make something for Editor as well.

    LOD needs to be done separately with the current version, I'm working on detecting LOD fully automatically which will be in the next update. I explain it here:
    https://forum.unity.com/threads/mesh-combine-studio-boost-performance.501543/page-2#post-3272884

    I have the new version almost ready and will try to release it beginning of next week.

    Yes you need to set the combined gameobjects to static manually, will add an automatic feature for this if you choose 'Lightmapping' option. That is indeed strange, can you check if the combined mesh has UV2? (If you click a combined object then in Inspector click on the mesh).

    There's a discussing about LOD lightmap baking here:
    https://forum.unity.com/threads/lod-group-baked-lighting-how-to-use.349103/

    Which Unity version do you use?

    Nathaniel

    upload_2017-11-4_20-11-17.png
     
  6. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Do you use any Lod meshes with Unity's LODGroups? I found out that Unity rebakes every LOD object in the lightmap if there's no LODGroup attached or deactivated. So that might explain the increase of lightmap texture size of combined meshes.

    You can attach this script to your search parent and it will list the amount of LODgroups.

    Nathaniel
     

    Attached Files:

  7. artysta

    artysta

    Joined:
    Nov 15, 2009
    Posts:
    124
    Sorry, I'm not using any LOD's in my project. It's all interior rooms, no outside or terrain type settings.
    I've experimented with all 6 of my scenes, and all produce the same results, lightmap sizes jump from @5MB to @100.
     
  8. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    I love the idea

    However it is obviously in very alpha stages. For example, It does no combine all the time, I keep constantly getting "_Umcombined" without any results. ( Also spell mistake here, it should be "_Uncombined" with a "n")

    Regards.
     
  9. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It only needs 1 bug not to work, doesn't make it a very alpha stage ;)

    Did you try the fix from here:
    https://forum.unity.com/threads/mesh-combine-studio-boost-performance.501543/#post-3270146

    I have a new major version almost ready.

    Nathaniel

    Edit: With the fix the vertice count increases, but with the new update this is solved, I made a new combine job manager system that supports multi-threaded combining and combining per frame so it can be used at runtime to combine on the fly, e.g. with level editors with keeping fps intact.
     
    Last edited: Nov 6, 2017
    MoribitoMT likes this.
  10. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    264
    got to say I was skeptical at first, but its much better than the standard unity static batching
    the sweet spot between culling and draw calls is sweet indeed

    happy about this purchase
     
  11. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I'm glad you like it :) Feel free to post a review or give a rating.

    Nathaniel
     
  12. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    320
    HI I have a question about Mac support, I'm running version 5.6 but I'm not sure about GPU metal support. How would I figure that out?

    Also how long is the sale?
     
  13. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It's compatible with Mac/Linux and all platforms. I'm not exactly sure how long the sale will last, but for sure this week.

    Nathaniel
     
    Aaron2348 likes this.
  14. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    320
    I'm super sorry, I thought I posted my question to the Terrain composer Forum, Does the same support apply for Terrain Composer?
     
  15. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes TC2 supports Mac with Metal (it needs as it uses compute shaders), but since Unity recently implemented this starting from Unity 5.6 and also on Mac itself Metal is quite new there might be some bugs that compute shaders don't work all the way for specific hardware. For some it works for some it doesn't. You can try it and if it doesn't work correctly I can give you a refund. Best is to have everything up to date, latest Unity 2017.2, latest Mac OS and latest video card drivers.

    Nathaniel
     
    Aaron2348 likes this.
  16. Sailing

    Sailing

    Joined:
    Sep 6, 2015
    Posts:
    12
    Hi, I got these output message, when I click the combine button........
    No matching GameObjects with LOD 0 'Search Options' are found for combining.
    UnityEngine.Debug:Log(Object)
    MeshCombineStudio.MeshCombiner:AddTransforms(Transform[], Int32) (at Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:505)
    MeshCombineStudio.MeshCombiner:AddObjects(Int32) (at Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:436)
    MeshCombineStudio.MeshCombiner:AddToOctree() (at Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:232)
    MeshCombineStudio.MeshCombiner:CombineLods() (at Assets/MeshCombineStudio/Scripts/Mesh/MeshCombiner.cs:362)
    MeshCombineStudio.MeshCombinerEditor:OnInspectorGUI() (at Assets/MeshCombineStudio/Editor/MeshCombinerEditor.cs:110)
    UnityEditor.DockArea:OnGUI()

    I update to 1.02 and it worked, but the result is not good as I expect,basicly it do not combine all the same material together, let say, I have 5 meshes with same material, it's only combine 3 meshes no matter what parm I change, the result is the same.
     
    Last edited: Nov 9, 2017
  17. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    The message means that no meshes are found based on your search parameters.

    Can you show a screenshot of you Unity window with the Scene view after you click the search button? It gives an overview of the cells...

    Nathaniel
     
  18. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi,

    Wondering about when the updated version will be in asset store ( specially with the not increasing mesh vertex size )

    Regards.
     
  19. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    I will post it here when it's ready, Asset Store will take a few days before they approve. I will need a few more days to test it more and implement the last changes. I added a lot of new features:

    Features:
    • Super fast, efficient and low memory consumption multi-threaded mesh combine job system (with exposed API for using at runtime).
      With settings like Combine meshes at once, or x amount per frame, using x amount of threads, etc. Will be able to add/remove objects and re-combine for level editors, etc.
    • Completely automatic LOD detection and combining.
    • Completely automatic handling for the Unity Editor of original GameObjects, MeshRenderers and LOD groups get disabled/enabled automatically.
    • No increase in vertex count.
    • Support for negative scaling.
    • Support for lightmapping in Unity Editor.
    • Save meshes to can make prefabs.
    • Combining for dynamic objects without any cells.
    • Cell offset.
    • Runtime console to change combine settings and re-combine.
    • Max bounds search option to exclude big objects.
    • Drawing of mesh bounds.
    The update after this one will be removal of geometry under the terrain or mesh (can save up to +30% of geometry on e.g. rocks) and then the next thing will be implementing texture atlassing.

    Nathaniel
     
    Last edited: Nov 9, 2017
    Gametyme, matteumayo, Arganth and 5 others like this.
  20. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,274
    Hi. Will updated version contain my request of supplying my own list of game objects to combine API ? (on runtime) I am waiting for this feature so I can buy the asset. I hope I can get it before the sale end. But I need this feature to be able to use it in my game.
     
  21. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes the new update will have this feature ;)

    Nathaniel
     
    Quique-Martinez likes this.
  22. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,274
    Thanks for the update!.

    I also read somewhere that in order to use lightmapping , we need to do combine only in the editor, not during runtime.
    Unity's static batching runtime combine does work however.. so I am not exactly sure why this isn't possible with this asset?
     
  23. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Hi Nathaniel,

    I was interested in your very useful looking asset, purchased it earlier today, but seem to have a problem using it currently. I have a rather large scene,with many objects so I hope your asset will hopefully boost performance a a lot!
    But I see some "Mesh.uv2 is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array." and "ArgumentOutOfRangeException: Argument is out of range."errors (at runtime only, not wen editing), see screenshot:
    error.png

    You will notice the search tool has found 45053 objects, is this number ok? I assume so as it is showing in green text?
    Why are these errors showing?
    Unfortunately performance has not improved at all from what I can see, static batching is turned off.
    Is there anything you can recommend I try in terms of settings to improve performance, or should it just work?
    Thanks for any input/help you could provide, I'm really hoping your script/asset will help me out with performance :)

    Also when I first started using the meshcombinestudio prefab, I did not realise straight away to increase the scale of it to reach other objects too, maybe that can be documented? Or should I not be doing this?
     
    MoribitoMT likes this.
  24. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes I was wondering the same, but this is not really possible as in Unity4 it was. It's explained in this post by Ben an Unity dev:
    https://forum.unity.com/threads/imp...garding-mesh-uv-channels.370746/#post-2402508

    Yes when that error happens it doesn't properly combine. So you won't see any difference in performance. I fixed it in an update that I posted on the first page on this forum:
    https://forum.unity.com/threads/mesh-combine-studio-boost-performance.501543/#post-3270146
    Also in this update I included the feature to detect objects automatically without needing to use the search box.

    45053 objects seem a lot. What type of objects do you use, do they have different LODs?

    Nathaniel
     
  25. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    I have to admit that scaling the MeshCombiner never occurred me in the beginning. I thought it finds auto all meshes in the scene and add cube cells accordingly, so I was getting this Lod and No mesh found warnings. A better documentation would be great.

    Regards.
     
  26. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes but the search box will be disabled on default in the update. I will update the documentation with the new update and also make tutorial videos.

    Nathaniel
     
    MoribitoMT likes this.
  27. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Hi Nathaniel, Thanks, I have imported your update, that solves the errors ,thanks!
    Still not seeing a performance difference though, not sure why.
    Even if I see a small change I will at least know it is working, but I'm not yet.
    Also if I try to use more than one meshcombine prefeb in a scene (to combine more than one parent), it has a bad effect, double the polygon count. I assume we are only supposed to use one per scene?
    I have tried various things, e. lessen the object count (2000 to 40000) found, no change.
    The objects are standard meshes of various types, (To get an idea, see this video for a sample
    , it is an open world archaeology game, I have used additional "terrain" meshes that allow for mesh deforming) is there any type mesh that won't work/be effective?
    No LODS setup on a lot of my objects, does your asset depend on LODs being setup?
    Any recommendations would be very welcome.
     
  28. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Whenever triangle count doubles, it means that you are rendering the same objects twice, so yes that will only make things slower. Do you combine in the Unity Editor or at runtime? In the Editor you need to disable the old objects manually. In the update I have this automatic as well.

    EDIT: I wonder if you don't use LODGroups, how do you let rocks appear/disappear around the camera?

    Nathaniel
     
    Last edited: Nov 11, 2017
  29. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Hi,
    "Do you combine in the Unity Editor or at runtime?" - I have tried both.

    "how do you let rocks appear/disappear around the camera" - via:
    GetComponent.<Camera>().layerCullDistances = distances are set in arrays; These I can change in game.

    I have just tried to disable the original objects at runtime, that does appear to help, I did not realise that should be done , silly me, it makes sense! I might be starting to see the light at the end of the performance improvement tunnel :)
    I see some strange effects such as renderers that I disable that now show, and particle effects not showing when they should, all of these effects / objects are in the same parent object, your asset must be affecting the renderer somehow, I might need to split them into different groups? I'll have to play around more.
     
  30. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    khos,

    Watching your video, the problem could be anything. Have you profiled your game, what makes jittering the fps spikes ?
     
  31. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    It's the recording software and speed of my disk :)
     
    MoribitoMT likes this.
  32. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes if you disable just your object parent, then colliders, scripts, particles, etc won't be enabled anymore. But if you enable the 'Combine at runtime' feature, it automatically gives the option to disable to MeshRenderers of the original uncombined objects, these settings should do it:

    upload_2017-11-11_12-11-16.png

    In the update I will have this working for the Editor as well.

    Nathaniel
     
  33. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Ok, here couple of performance suggestions.

    1. Ditch dynamic shadows, use blob shadow on vehicle, rest use static light mapping
    2. Use occlusion, if you have money I suggest more effective solution from asset store SECTR occlusion, also use occluder inside mountains not to render behind of mountains.
    3. Use sky cube 1 draw call
    4. Combine most parts of vehicle and create texture atlas on vehicle ( reduce draw calls to minimum )
    5. If you should have long draw distance, you have to work with LODs to reduce mesh/draw call sizes
    6. Do not use unity trees, grasses, etc.. Use optimised atlassed grasses and trees from atlas store
    7. Have your vehicle in the first root of hierarchy, also never have unmoving parts/gameobjects as children of your vehicle ( waste of performance with additional transform calls )
     
    twobob likes this.
  34. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Can you link me that asset for the occlusion? I'm having a really hard time set up occlusion in my open world game. As I move the camera up/down grass starts disappearing and the water reflection is flickering even if I enable Ignore OC (using Aquas Lite)
     
  35. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
  36. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    1). He has dynamic day/night cycle, so needs dynamic shadows...
    3). This is a bit overkill.
    4). Will be possible with MCS with next update, texture atlas will be implemented soon.
    5). Agree.
    6). I recommend to use vegetation studio.
    7). Yes having many children in a dynamic object can slow down performance. Would be great to have GameObject type that doesn't use position/transform/scale so it wouldn't influence performance. Unity is working on a new component system, hope they have something included like this.

    Nathaniel
     
    TeagansDad, Anon32 and MoribitoMT like this.
  37. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Hi, thanks for the suggestions, if I use a time of day system how will disabling dynamic shadows/lighting work, maybe this will be for another topic.. I don't think I can use static light maps.
    I'm getting LOD's setup. Can Nathanial's asset setup LOD's?
    Combining meshes, isn't that what Nathanial's asset does ? :)
    I'm not using Unity grass/trees.,
    I do know that my performance issue arrises from huge amount of verts/triangles/meshes used in scene, as if I disable that parent object FPS goes to 70..I am almost sure Nathanial's asset should help. It's just a case of me figuring out how to use it properly with my content.
     
    MoribitoMT likes this.
  38. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Are you using realtime lighting or mixed mode?
     
  39. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Static shadows can only be baked if directional light position doesn't change, so for dynamic day/night cycle this is not possible.

    He means combining parts of dynamic meshes, like with your car (it could be that its optimized already). E.g. if the body of the car and chairs are each separate meshes, they can be combined into 1 mesh, as they won't move individually.

    MCS doesn't create simplified LOD meshes, but it supports combining them and make it render faster. Many model Asset packs from the Asset Store have lods included.

    Nathaniel
     
  40. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210

    Hats off guys.
    Just benchmarked the scene above ("Dirty Apartments" on Asset Store).
    Running in the editor window, but with HBAO and SEGI realtime global illumination.

    Before MCS:
    95 fps

    After MCS:
    330 fps

    After MCS, without updating GI every frame:
    500-600 fps
     
  41. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Realtime.
    Started tweaking my scene, have seen 10 > 30/40/60FPS improvement.

    Realtime, I'm also already using my own
    Hi, how should I control the disabling of the original parent object when the script combines at runtime? Does this object need to be disabled after the combine has occurred at runtime?
    Currently if I leave the parent object disabled then build then play I don't see any objects, I only see combined objects if I leave the parent object enabled, then combine at runtime, then disabled parent object. Can you provide a recommendation for this?

    If I use the combine in editor (so non combine at runtime option), then wait for the whole process to complete, then save my scene (note your asset detected 30000 objects), Unity it takes all of my disk space on my SSD(roughly 20 GB's worth)... what is this doing? Once the whole saving process is complete I noticed that my unity .scene file is now 5GB!! Just because of the combined objects that have been created.
    I realise I might have a lot of objects (lots of rocks) but wonder if your asset is designed for these numbers, is there a recommended number of objects to work with?
     
    Last edited: Nov 12, 2017
  42. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    481
    Every object that does not move should be static you can use Mixed Lighting instead and bake the shadows, then even if you rotate the sun the shadows will rotate, because baking will bake from multiple angles. There are limitations though, if you change the lights color, the indirect lighting wont change at runtime, but the performance will be better.
     
  43. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    Yes for that many rocks they shouldn't be combined all at once in the Editor. As combining (batching) takes more VBO memory, it needs to be implemented wisely and combining on such massive scale takes too much memory. Memory usage is the same as with Unity's static batching:
    https://docs.unity3d.com/Manual/DrawCallBatching.html

    After the coming update (in the next update) I will implement the feature to stream around the camera (next week). This will solve the memory overhead of combining such a massive amount of objects, and it allows to stream a massive amount of detail objects (rocks, branches, props, etc) around the camera.

    In the case of rocks another possibility is to use GPU Instancing which Vegation Studio uses. GPU Instancing uses the original mesh and doesn't add VBO memory, only downside of it is that it doesn't support multiple different meshes with the same material within one draw call and no lightmap support (in your case you can't use this anyways as it's too much data). In case for vegetation VS is a great solution, rocks is an overlap where both MCS (with the stream update) and VS are good solutions, when it comes to everything else like combining regular meshes, parts of buildings, props, etc you can use MCS for this.

    Wow awesome results, thanks for sharing :)

    Nathaniel
     
    Last edited: Nov 12, 2017
    matteumayo likes this.
  44. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    Thanks for the info, I'm hoping the new feature will give me an easy performance boost :)
    I still am not sure how to control the automatic disabling of the parent object when the combine is done at runtime, any advise on that would be welcome. Do I have to do this myself via a script currently, how do I know when to progamatically disable the parent object?
     
  45. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    If you have this settings:


    'Original Objects' -> Disable Renders, this will automatically disable the MeshRenderes of the original objects when combining in runtime. All colliders/script on original object will keep working.

    Nathaniel
     
  46. Anon32

    Anon32

    Joined:
    Oct 11, 2013
    Posts:
    28
    Oh hell yea. :D Nathans got all the bases covered.
     
  47. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210
    Why is it not possible to have the "Disable renderers" active when combining in Editor?

    (Also, there's a typo, it's renderers instead of renderes)
     
  48. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,704
    It will be possible in the new update, probably will post it here today or tomorrow. Yes I know that it is renderers, thanks for pointing out the typo :)

    Nathaniel
     
  49. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210
    Thanks, that's great News.
     
  50. Sanyol

    Sanyol

    Joined:
    Jan 28, 2013
    Posts:
    22
    Hello,

    great asset!

    Can you tell us when can we expect newest update with "Lightmap Editor Support" ? Also how this support will work?

    Do you copy lightmap UV when baking meshes (When orginal meshes have "Generate Lightmap UV")? We have strange results with baking lightmap in combined meshes right now :/

    We're looking forward for update!
     
unityunity