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,705
    Hi, Caves & Overhangs 1.21 is still pending, think it will be accepted today. The fix is in the attachment...Let me know if you still get holes from triangles that shouldn't be removed...

    Edit:
    The update just got accepted and is on the Asset Store now.
     
    Last edited: Jun 29, 2020
  2. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Looks great, few questions:

    - is it destructive to the scene? what happens to the original meshes and objects? can you just turn it off and on to revert to what you had previously?

    - how does it handle materials? What if im using different shaders, and some materials are emissive and some arent etc? Will my scene be guaranteed to look "identical" after using this or not?

    - is there a demo version to see if it "works" for my project before buying?
     
  3. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    That are good questions:

    1). Yes it is, but combined meshes can also be saved to reuse in other Scenes. On the original objects, mesh renderers are disabled, so colliders and scripts keep working, etc. Can also regenerate new colliders in case of geometry removal. You can always easily revert by undoing the combining, or just switching between the 2.

    2). Yes guaranteed to look identical.

    3). There's no demo version, but currently it's on sale and you can pick it up really cheap (sale will end tomorrow). If it doesn't work for you I give a refund within 2 weeks of purchase...
     
    Last edited: Jun 29, 2020
  4. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hey there,

    Just tried the demo scene "example Cave" in a fresh project, the combining does not work properly.

    Repro :
    -Create a 2019.3.15 project, add MCS 2 v2.74 and MCS Caves & Overhangs v1.21
    -Open "Example Cave" scene.
    -Click "combine" in "MeshCombineStudio" gameobject.
    -Notice how the combining is broken and removes some wrong faces, creating holes in the mesh.

    Thanks for your feedback :)

    Edit :

    Before combine :
    Capesfdefture.PNG

    After combine :
    Captesfrure.PNG
     
  5. eagle555

    eagle555

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

    Thanks a lot for reporting. Strangely doesn't happen in Unity 2017.1 (this I use to submit the package to keep capability with older Unity versions). But I'm able to reproduce it in U2019.3.14f1. We're using U2019.3 for our game and our artist made some new arenas with geometry removal on rocks and it seemed to work fine. Maybe something went wrong with the update. Will look into fixing it now...
     
    corjn likes this.
  6. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Hey, I'm using Unity 2019.4.0f1 and I've just attempted to implement this into my project. Everything is working great apart from the lightmapping.

    Here is a before and after screenshot of a part of the level.

    Without MCS:
    BakeWithoutMCS.png

    With MCS:
    BakeWithMCS.png

    You can see that the lighting is now completely broken after rebaking. Is there any way to fix this?
     
  7. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hey, thanks for reporting. Might be a setting...Can you show a screenshot of your MCS Inspector?
     
  8. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Sure, here it is. I've tried it with both static and dynamic batching turned on and off and get the same result.
    MCSInspector.png
     
  9. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    The lightmap settings look fine. Can you try it without backface geometry removal if it's still wrong?
     
  10. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Ah sweet, that has fixed it and the lightmap is looking identical to before. Guess I'll have to live without backface culling for now then. Thanks.
     
  11. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Ah ok great it works now. Also best to do it only on the outside geometry, as the combined meshes with backfaces removed need double sided shadows which is more expensive, which is kind of a waste on geometry inside your box volume. If it only removes 8% it might not get any faster.
     
  12. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I found the issue. U2017.2 and up introduced Physics.SyncTransforms() and Physics.autoSyncTransforms setting. If auto sync transforms is disabled Physics won't update the colliders right away after moving a transform, so then you have to call Physics.SyncTransforms() manually. On default seems to be disabled in U2019.3 and with my recent update I'm moving all removal colliders to the scene origin per cell to get more accuracy. The fix is in the attachment...Also submitted it to the Asset Store...
     

    Attached Files:

  13. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Woah, that was quick, thanks a lot ! Just tested it and now it's working great !
     
  14. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Hey, sorry but I have no idea what happened earlier. I hit play and my lightmaps deleted themselves and wouldn't bake again. I restarted Unity and the baking is working again now however my scene is back to the broken lightmap. Same settings as earlier but without the "remove backface tris" setting.

    EDIT: I've lowered the cell size to 16 with an X8, Y8, and Z8 cell offset and the lightmap is slightly better but obviously the batches went up a lot:
    BackWithMCSLowerCellSize.png

    Others areas are unusable:
    kitchen.png
     
    Last edited: Jun 29, 2020
  15. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Strange, that looks like a Unity bug. Does baking still work correctly without combining?
     
  16. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Yes baking works perfectly fine without combining
     
  17. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Oki that's good. It was working before with combining right? What if you delete the combined and re-combine, does it work then?
     
  18. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hey @eagle555 ,

    Tried MCS on my main project this time, I have some holes created in my landscape when "remove overlapping tris" is ticked, even with your fix. But this time it's probably coming from my project, since it's working fine in your demo scene :

    -I'm using rock and boulders 3 and quixel megascans rocks. Some of them are designed with mesh holes (for performances), is that a problem for MCS ?

    -The mesh normals seems to be a bit different when combined, is it a bug ? You can actually notice that in your demo scene, go in the cave, press tab and notice how the paralax is different.

    Screenshots of my settings :

    Captdrggfure.PNG Captdrggdgvdffure.PNG

    Still with Unity 2019.3.15

    Besides that, i'm really happy and can't wait to make MCS work with my project. I was doing this by hand selecting all the faces in maya, with more than 1000 rocks it took hours of work :')

    Thanks in advance for your insight !
     

    Attached Files:

  19. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes removing manually is a super tedious workflow...

    1) Yes for overlapping removal to work meshes need to be closed (without holes). That's probably creating the holes. There's no way I know of to solve it for meshes with holes. As I'm using accurate mesh colliders to represent everything and then check if I'm hitting a backface in a mesh collider to know if a vertex is inside or not. If the mesh has a hole it will hit a backface while it shouldn't. So only option is to close those rocks that have holes (visually doesn't matter how it looks, as you can always keep that closed part hidden beneath terrain or inside another rock).

    2) The normals and tangents are the same, I have a 'VisualizeMesh' script which shows normals/tangents and from uncombined and combined they are the same. When removing heightmap texture on the standard shader, there's no difference. So I'm wondering where the difference can come from...
     
  20. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168

    1) Okay, thanks, yes it makes sense, that's what I guessed. But as I didn't find the info in the documentation (maybe I missed it) I wanted to make sure that's what I needed to do to make MCS work.

    2) Not 100% sure it's normals in my scene, but it looks like it is. I'll investigate more and will let you know if I find anything :)
     
  21. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Still the same issue but I think it may be a problem with the models I am using. I have used MCS on another level that uses different models and it worked almost perfectly, there is still a few lightmapping issues but again it could be down to those models.
     
    Last edited: Jun 30, 2020
  22. inkostyakov

    inkostyakov

    Joined:
    Nov 14, 2016
    Posts:
    48
    Hello! I have a question.

    For example I have 1000 game objects on scene. There is some scripts on this objects. Each of this object contains another objects with renderers.

    I want to combine each of this 1000 objects in runtime, but keep it separate from each other. And I want keep combine result inside original object hierarchy.

    A
    a 1
    ...
    a x

    to

    A
    a 1 combined
    a y combined

    What is the best way to do it?

    Now I see, that MeshCombined can accept one Parent object to combine, and put combine result into object which contains this component.

    Thanks!
     
  23. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Hey, is there any way to exclude objects by name or tag? With the way my hierarchy is setup it will take a long time to move them all out to their own parent object.
     
  24. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    There is options for tag, layer, name searching and more. :)
     
  25. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I'm a fan. Bought and reviewed. It was on my list for a while, only just got around to buying. It certainly does a great job with massive buildings (exteriors and interiors) - doubled my fps, reduced lag on that specific building I was having issues with, so will do the rest of the large scale buildings. It's an old shot, using Unity 2017, on 2019.4 now. Works great! Keep up the good work on this and the other products. :) A time saver too!

    bigcity2.jpg
     
  26. PunkPuffin

    PunkPuffin

    Joined:
    Jun 17, 2018
    Posts:
    14
    Hi @eagle555

    I bought your asset today thinking it might help me. Now I've given it a go I'm not so sure...

    I'm pretty new to unity so if I get this all wrong let me know.

    Is it possible to combine objects with Different Materials in to one object?

    Does combining essentially result in Overlapped UV Maps?

    The documentation appears to be out of date as it looks nothing like the version I'm running. If I set a parent object and no combine conditions should it combine everything under the parent object or do I have that wrong?

    Thanks for your help
     
  27. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    1) Think I only mention it in the description on the Asset Store. I will update the documentation today and also will add the explanation for 'Combine Conditions' which I recently added.

    2). Oki thanks :)
     
  28. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Maybe the import settings for those models are different?

    Yes that's possible (as Julianr says):
    upload_2020-7-1_7-35-37.png
     
    Last edited: Jul 1, 2020
  29. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Can you explain in more detail? So you want to combine those 1000 objects separately and only combine the meshes inside each object. So you can still move any of these objects around?
     
  30. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks a lot for your review, I'm glad you like it. Wow...looks massive indeed! Do all buildings have interiors?
     
  31. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks for purchasing and contacting. Combining can help a lot in many cases, but it depends on your project. Maybe you can explain in more detail what kind of objects you want to combine?

    Yes the 'Combine Conditions' is a feature I recently added. I will update the documentation now ;)

    Combining does not change the UVs, they can be copies over. They can also be recalculated in case of removing geometry to save lightmap texture space.

    Yes it's possible to combine different materials into 1 material, but that will change the look to that 1 material. Just disable 'Same Material' and you can choose your output material. Combining the same shader with different materials will be possible with Mesh Combine Studio 3, I will start working on this soon.

    Combine Conditions works in this way:
    If you select a 'Same' setting, MCS will combine meshes separately that have that setting different. E.g. 'Same Material' enabled will combine meshes that have material A into a combined mesh, and meshes with material B into another combined mesh. Disabling it will combine all meshes into a combined mesh with a material you can choose. E.g. with 'Same Cast Shadows', MCS will combine meshes with shadows into a combined mesh and meshes with no shadow into another combined mesh. Disabling it will combine all meshes into a combined mesh with and the output will be the Cast Shadow option you choose.
     
  32. inkostyakov

    inkostyakov

    Joined:
    Nov 14, 2016
    Posts:
    48
    Yes! Exactly!
    I have complicated objects with a lot childs. I want to keep possibility to edit them in Editor mode. But in Runtime them produce a tons of batches, so I'd like to merge them.
     
  33. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    They sure do. Most have streamed in interiors as the player gets closer with detailed exteriors, and lower detailed exteriors as the player moves away with 360 degree billboards the further away you are. The larger skyscrapers have lower interiors, and underground carparks where as the higher parts (offices/penthouse suites/apartments) will have procedural levels based on the lift number you select. I've not got around to that yet, but no doubt I'll combine the meshes with this asset to speed things up. :)
     
    Last edited: Jul 1, 2020
  34. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    So basically they are dynamic objects and you want to be able to keep moving them? It's currently not possible but I can make something for this, just thinking about what's the best way to do this. As if they are dynamic you probably want to move the original and the combined should be moving as well...
     
  35. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Wow that sounds very cool. I'm curious to try it out :D
     
    julianr likes this.
  36. inkostyakov

    inkostyakov

    Joined:
    Nov 14, 2016
    Posts:
    48
    Yes I'd like to take childs in parent, combine them, and put result into original parent. And to it for each parent in some parent array.

    The only problem is that objects are dynamic? Can I do such thing with static result?
     
  37. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes you can but of course then you can only move the parent which moves everything you combined. Is that fine?
     
  38. inkostyakov

    inkostyakov

    Joined:
    Nov 14, 2016
    Posts:
    48
    So, I must create one MeshCombiner object, combine one by one objects with it, and move result from MeshCombiner to original parent?
    Ok. I will try.
     
  39. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    No I'm just asking what exactly you need. I need to implement this option in Mesh Combine Studio for you...
     
  40. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I'll drop you a key when it's ready to go.. :)
     
  41. inkostyakov

    inkostyakov

    Joined:
    Nov 14, 2016
    Posts:
    48
    I would be great!

    I'll try to discribe my case.
    I have converted CAD model with a lot of little model. I generate array of GameObject, for each of this element I want combine its children, and keep result inside this element.
    For example, I have car wheel. It contains 100 child models, I want to combine them into few models. And repeat this procedure for all elements in array.

    Thanks!
     
  42. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks, looking forward to it :)


    Oki thanks for explaining, I will make something for this tomorrow ;)
     
    julianr likes this.
  43. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    julianr likes this.
  44. PunkPuffin

    PunkPuffin

    Joined:
    Jun 17, 2018
    Posts:
    14
    Hi

    I'm not sure I'm understanding or I'm just doing something wrong.

    What I want to do is combine 2 objects. Here are my settings.

    So the Parent object has 2 prefabs in it which are just simple meshes with a collider and a white material assigned.

    Combine does nothing. From my understanding setting no conditions would select all the objects and merge them in to 1. And I still don't quite get how you merge objects with different materials.

    upload_2020-7-2_13-23-57.png
     
  45. eagle555

    eagle555

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

    Deselecting 'Same Material' will combine all meshes into 1 material. Not sure if that's what you are looking for as when using different materials on the original objects those would change. What you need to do then is assigning the output material like this, then it should work:

    upload_2020-7-2_6-56-2.png

    MCS throws an error when the output material is not assigned, I will make it show a specific message that it needs to be assigned.
     
  46. PunkPuffin

    PunkPuffin

    Joined:
    Jun 17, 2018
    Posts:
    14
    Oh I get it now...

    I thought the Material you set there was a way of saying only combine objects with this material.... That was my misunderstanding there. So when I set that to an empty material then it works as you say.
    Thanks
     
  47. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Yes I also got an email of someone with the same issue. This might be confusing, also that the GUI is showing something extra with disabling a toggle, while normally that is the way around. so I'm flipping this around now and instead of using 'Same Material', I use 'Change Materials', 'Change Cast Shadows', etc. Think that way is more clear...
     
  48. eagle555

    eagle555

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

    Here's the update with Combine Conditions GUI flipped, think it's more clear this way:
    upload_2020-7-2_8-1-29.png

    Will also update the manual...I will submit a new version to the Asset Store also for MCS Caves & Overhangs with an improved camera in the example Scenes. Without the need to import first person controller for the Caves & Overhangs example.

    Edit: Fixing a bug...
     
    Last edited: Jul 2, 2020
  49. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    Hey, how do I get the "Copy Baked Lighting" option to show? No matter what I do rebaking the lightmap has artifacts/ leaked lighting everywhere so I need to try this way out.

    Here is my inspector
    MCS Inspector.png
     
  50. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    It requires lightmapping to be baked. I have this if condition:
    `if (Lightmapping.bakedGI && !Lightmapping.realtimeGI)`