Search Unity

Mesh Merge and Splice

Discussion in 'Assets and Asset Store' started by Tryz, May 31, 2014.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Mesh Merge and Splice

    Improve performance by reducing draw calls!

    Mesh Merge and Splice will combine the scene objects you select into a set of efficient ‘material based’ meshes that can simplify the rendering process.

    Since it’s best to render objects with the same material at one time (to avoid having to unload and reload material data), all object meshes with the same material will be merged into a single mesh. In this way, you can select lots of objects and Mesh Merge and Splice will organize and merge them as needed.

    Features
    • Merge objects with the same materials
    • Supports objects with multiple materials
    • Supports objects with sub-meshes
    • Creates multiple merged meshes in one selection
    • Manage source objects after the merge
    • Ability to split objects based on materials

    Documentation
    Intro Video

    $ScreenShot_01.png

    $ScreenShot_03.png

    Get It Now!
     
    Last edited: Jun 3, 2014
  2. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Hi seems a pretty handy tool! and price is pretty reasonable too!
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Rhodnius,

    Thanks for the comments. I found I've been using it quite a bit in my own scenes. :)
     
  4. Ebolinux

    Ebolinux

    Joined:
    Jan 23, 2014
    Posts:
    117
    Any idea why it is dong this?
     

    Attached Files:

  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    How many of the trees are you trying to merge? Does it happen if you just try to merge two?

    It looks like vertices are getting mangled as it's being merged. Can you send me the scene you're trying to merge? If it's too large, even just a couple of trees this is happening with.

    Please send them too tim@ootii.com and I'll look into it.

    Thanks
     
  6. Ebolinux

    Ebolinux

    Joined:
    Jan 23, 2014
    Posts:
    117
    There are around 10k trees. they are all randomly sized.

    How do i just grab a couple of them and package them up?
     
  7. Ebolinux

    Ebolinux

    Joined:
    Jan 23, 2014
    Posts:
    117
    When I take just 2 of the trees (as prefabs from the project) I can merge them fine. They are not resized or anything.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Is there any difference in the merging to the Combine Children script Unity offered ?
     
  9. Ebolinux

    Ebolinux

    Joined:
    Jan 23, 2014
    Posts:
    117
    Did a little testing. This is on big nice trees.

    20 Trees worked
    40 Trees worked
    60 Trees did Not work

    At 60 I started getting lines.

    Have you tested mesh merge on large numbers of trees to see if it is a good way to up the FPS?

    I have about 10k trees. Maybe it would be better to try and do the trees another way. We took a script and pulled the trees off the terrain and into game objects. Adding LOD's to the trees wont work currently because a LOD would have to be added to every single tree since they are not in prefabs. Don't know if a billboard script would work
     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Ebolinux,

    60 trees seems, low but it may depend on the number of vertices they have. It definitely won't handle 10k trees. You'll want to use Unity's terrain system for that. You don't want to do this anyway because then you can't split your scene into visible regions. With visible regions, Unity will simply not draw trees that aren't in the camera's view. Nothing faster than not drawing :)

    I think you're the one I'm talking with in email, but at some point too many vertices seems to get corrupted by Unity's underlying function. If you can send a tree to tim@ootii.com, I can play with it some and confirm this is what it is.


    Hi Naso_33,
    I'm actually using Unity's 'CombineMesh' under the hood. However, it doesn't merge based on materials automatically (or splice at all). If you don't manage these yourselves (or with another tool like Mesh Merge), you'll find the CombineMesh function doesn't actually help.

    That's actually the issue that I'm talking about with Ebolinux too. I've found that in the case of extreme vertices the function seems to wrap the underlying vertex buffer and create these lines.
     
  11. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Thanks for clarifying.
     
  12. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Can this make prefab of the merged mesh?
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes. Someone asked for this just the other day. :D

    Version 1.5 (which is live now) has the ability to save the resulting merged mesh as an asset. That allows you to create a prefab out of the merged mesh.

    Check out page 6 to learn how.
    http://www.ootii.com/Unity/MeshMerge/MeshMergeUsersGuide.pdf
     
    BackwoodsGaming likes this.
  14. Adragen

    Adragen

    Joined:
    May 4, 2013
    Posts:
    25
    Hi i have just purchased this but wanted to ask a few questions as i have had mixed results with my scene where my statistics window seems to have doubled in terms of tri counts etc and my fps has actually got worse. Q1: After creating the new meshes (with your tool )should i be deleting the original meshes from my project, disabling or hiding the mesh? Q2: should merged meshes be dissapearing? I have a series of fences (identical) in a line but after i merge and select option to hide mesh some of the fences dissapear and only reapear if i hit the show option within the tools window. Q3: i should probably already know this answer lol but will ask anyway, after i merget a bunch of trees the leaves no longer move with the wind, is this normal or fixable? My scene ultimately could have a lot of trees in it over a big area so not a forest but a plains so i need them to function correctly. I love the tool and think it will definately benefit me but im unsure if im using it correctly. At this point i feel something is wrong (my end obviously) as my performance actually got worse. Hope you can shed some light on the matter for me :)
     
    Last edited: Aug 7, 2016
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @Adragen ,

    Q1: I typically just hide the original mesh until I'm sure I don't need them as a source again. If I'm confident that I don't need the originals for anything (including collisions), I will just delete them. I do the deleting when I'm done with the scene.

    Q2: Once you hit the button, basically two sets of meshes exist: Merged Mesh and your originals. If you hide your originals (or delete them), the merged set should be the same. I'm thinking two things could be happening:

    a. Unity didn't fully select the fence pieces. I've seen Unity un-select things on me unexpectedly.

    b. Any chance, that part of the fence is using a different material?

    Q3: This is normal. The asset will create a static mesh. Your original trees are probably built to support wind or other features. You could treat the new trees as static meshes and add other components, but on their own they are just static meshes.

    Something to think about when dealing with things like fences and trees (and mushrooms like my video :)). Unity is pretty smart and will cull objects that aren't in the camera's view. So, you don't want to turn all fence posts into a single mesh. If you do, your whole fence will be rendered even if you can view just a tiny bit. Better to create reasonable clumps or groups.

    In my video, you can see I do that with the mushrooms. Since I have mushrooms all around, I could just create one huge mesh. However, if I'm only looking at a single mushroom the whole mesh goes to the graphics card. Instead, I'll merge mushroom groups. Then, culling will throw out a whole group if it's behind me.

    With the performance, I'm wondering if that's what you're running into. So, let's say I have a fence in a rectangle that surrounds me (the camera). I wouldn't merge all posts. Instead, I'd probably create 8 groups (4 corners and 4 straights that connect the 4 corners). This way, Unity will throw out the groups that aren't in view. That's still better than 400 individual fence posts. In this example, I'd hide the original 400 posts.

    I hope that makes sense. If you're still having issues, feel free to email me a scene and I'll take a look. Send it to tim@ootii.com. :)
     
  16. Adragen

    Adragen

    Joined:
    May 4, 2013
    Posts:
    25
    Hi, thanks for the quick reply. What you said has made perfect sense, i will do as you have stated and see how it goes. Thanks again :)
     
    Tryz likes this.
  17. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Hi Tim,
    I was seeking asset store for such kind of tool and I found your...
    does it work in runtime? i need to merge in my procedural runtime world creation.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Unfortunately, no. It's only edit-time.
     
  19. Kiwi-Hawk

    Kiwi-Hawk

    Joined:
    Jul 17, 2015
    Posts:
    288
    Kia ora

    I got this to merge the ocean mesh's from Suimono water asset. I have an island with two lakes so one ocean put two water levels one of the lakes that ruffly the same level as the sea. I made 4 planes to form the sea but theres somit about the way he's done his mesh that does not seem to want to play ball with your tool. when I select the four sea mesh's I notice it's counting 0 materials, is that maybe why this tool won't merge them? it would cut my sea back to one drawcall rather than 4 right.
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Probably. The tools uses the material of multiple meshes to determine if they should be merged. If there are no materials on the meshes, it won't merge (or splice) them.

    I do this because part of the overhead of draw calls is the reloading and swapping of materials. So, if 4 meshes use the same material, we can load the material once and render the four meshes as one. If there's no material, the tool doesn't know what to do.
     
  21. NaughtyMoleGames

    NaughtyMoleGames

    Joined:
    Jan 25, 2018
    Posts:
    51
    Hey @Tryz
    I own your other assets and really like them, wanted to see if this tool is still being developed? Noticed it hasn't been updated in a while, and no comments on the forum. Is this still a viable tool or do you recommend something else? Thanks!
     
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @gorxmedia ,

    It is still viable and people (including me) continue to find it useful.

    As a $15 tool, it's feature complete, robust, and does what I advertise.
     
  23. NaughtyMoleGames

    NaughtyMoleGames

    Joined:
    Jan 25, 2018
    Posts:
    51
    Awesome, I liked the simplistic approach it looks to take in the videos compared to other tools like mesh baker. Headed to purchase now. Thanks again.
     
    Tryz likes this.
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402


    Before updating, PLEASE READ THIS!

    This update REQUIRES that you delete your 'Assets\ootii' folder and re-import the assets.

    Today I'm pushing up a massive update to all my assets. The primary goal is to support Unity's Assembly Definition Files, but there's some other cools stuff as well:

    1. Assembly Definition File support
    2. New character wizard (for the Motion Controller)
    3. Restructure folders so demo files are in one place (easy to remove)
    4. Smaller download size

    Please back-up your project and wait for all my assets (that you own) to be updated by Unity. :)

    As always, I'm here to help.
     
    antoripa likes this.
  25. dirkjacobasch

    dirkjacobasch

    Joined:
    Apr 24, 2018
    Posts:
    418
    Hello,

    I just bought you MeshMerge asset and it looks good so far, but I've a question.
    When should I use Build UV2?
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That is for when you need a second set of UVs for light mapping. Not all meshes need them. It's up to you environment.
     
  27. dirkjacobasch

    dirkjacobasch

    Joined:
    Apr 24, 2018
    Posts:
    418
    Thanks for the quick answer. :)
     
    Tryz likes this.