Search Unity

  1. Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

Mesh Baker by Digital Opus [RELEASED]

Discussion in 'Assets and Asset Store' started by Phong, Nov 20, 2012.

  1. GameHourStudio

    GameHourStudio

    Joined:
    Apr 17, 2020
    Posts:
    104
    Thanks a lot phong. I used your clustering tool and add selection tool and this really speed up production. I just needed some feature like autoprefab making when using clustering tools and Hurrah! you have already implemented that as well. Your tool is my most favorite tool out of all tools I have used in past 14 months. I would like to however point out a problem I faced after combining meshes recently in 2019.4.5f1. It is about baking lighting on combined meshes. Unity has crashed for atleast 5 times in last 5 days as soon as I start to bake light on combined meshes. Previously I just used to copy lightmaps or preserve lighting but this time I noted doing this was causing a lot of artifacts. So I tried to bake lighting. With copy lightmaps as well as with generate new lightmap options. I receive in logs overlapping UVs error for a lot of objects approx 60 to 70% objects may be and after that it goes to crash. If I bake light on uncombined meshes then still I get this warning but without crash. I am using Unity 2019.4.5f1, Dell Inspiron i7-th Gen, NVDIA GTX-1050Ti. Tried both cpu lightmapper and gpu lightmapper but same crash. I don't know what other detail would be relevant to you about this. Let me know if you need to know anything else I will provide. Thanks.
     
  2. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Regarding the lightmapping. The "Generate New UV2 Layout" is the most reliable. However there are sometimes issues with this feature. It uses the Unity Unwrapping.GenerateSecondaryUVSet which needs to split vertices when it creates UV islands. These split-vertices can bump the mesh over the 64k limit. When this happens an error message is written to the console and the UV2 generation fails, however the method does not return a success/fail value so Mesh Baker has no way of knowing if the UV generation has failed. Mesh Baker still thinks it has generated a combined mesh. I would suggest trying to mesh-bake and check the console immediately after to see if there is an error. If there is then the only fix is to reduce the number of meshes in that bake.
     
    GameHourStudio likes this.
  3. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    760
    I found a couple bugs:
    1. it's not possible to filter by lightmapIndex 0 and 1.
      Fix: In MB3_MeshBakerEditorWindowAddObjectsTab.cs:141 & 141, replace
      i
      with
      i - 2

    2. when using preserve_current_lightmap, only UV2 is ever copied over. However, Unity uses UV1 for lightmapping for objects that don't have explicit UV2 and properly unwrapped UV1. This currently breaks (as objects get incorrect lightmap coordinates when I actually want to preserve the existing ones). My workaround was adding
      if (uv.Length == 0) uv = m.uv;
      to MB3_MeshCombinerSimpleData.cs:469
    Additionally, some usability issues:
    1. MeshBakerEditorWindow always forgets the previous settings again, this is particularily annoying when having the window open, then a domain reload happens - all settings are reset immediately
    2. When duplicating an object with a MeshBaker component (e.g. when I wanted to split by lightmap index), there was no warning that the result mesh asset will be re-used - this was a bit confusing because I kept overriding results with different settings until I understood that this asset was reused (it's an asset that is automatically created, so at first I wasn't even aware of it)
     
  4. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Thanks for the feedback. I will look into these issues and try to fix these in the next version.

    Re: The duplicating a MeshBaker. I was aware of this issue, but can't think of a good solution. When objects are created in Unity there is no way of knowing that it is a duplicate of another object. The only solution I can think of is to try to find all other bakers in the scene and check if any of them use the same mesh. I have hesitated to implement this since it is an expensive operation to search a scene.
     
  5. Gatskop_Software

    Gatskop_Software

    Joined:
    Sep 21, 2014
    Posts:
    77
    Just buy the asset and need help basic question I have an animated unity character
    What do I try to do add 300 of the same characters marching in a group
    Steps I followed
    - try with only on character first add a character to the scene and add an empty game object with MB3_Mesh Bajer script
    - Drag and drop character to Open Tools For Adding Object
    - Bake object settings on Bake Into Scene Object
    - Click Disable Renderers On Source Object
    With this, the character doesn't animated anymore.
    Tutorial video Mesh Baker Combine Skinned Meshes steps also did not work
    So what is the best way to do this with one animated character first
    and then when I want to use 300 of that same character
     
  6. SOIL

    SOIL

    Joined:
    Sep 2, 2011
    Posts:
    213
    I simply don't get it: My target is to bake several meshes into one mesh PLUS texture atlas.

    I was able to create only a texture atlas by trying the Mb3 Bake Texture script. But how to setup ONE baking process in where I can achieve exactly this?
    Please, can someone teach me that in simple steps? I only want to know the script setup and it's necessities (settings) in simple keywords? The video tuts are very long, old and totally confusing. Can't find other tutorials from others about that combination :/
     
  7. GameHourStudio

    GameHourStudio

    Joined:
    Apr 17, 2020
    Posts:
    104
    As you said, previously My any of meshes were exceeding 64k limit and were split. And the baking was failed. When I bake scene with small sized clusters now the light is baking correctly.
     
    Phong likes this.
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    There are a few important steps when baking skinned meshes.
    1) Set the "output" setting to "skinned mesh renderer"
    2) If the animated character doesn't move, check the culling settings on the animator. Try "Always Animate"
    3) If the character sometimes "vanishes". Check the render bounds on the combined Skinned Mesh Renderer. This may need to by larger or dynamically adjusted. There are some scripts to help with this. Check the manual for more detail on this.

    Check the example scene "SkinnedMeshRenderer". It bakes several renderers and skinned mesh renderers and also updates (adds and removes) from the skinned mesh.

    Let me know if you still have problems after trying these suggestions.
     
  9. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Hi Soil, I am just getting started on some new tutorial videos so expect some updated videos in a few weeks. A basic process is the following.

    1. Create a new Mesh Baker object in your scene. If your source objects exceed 64k vertices use a TextureBaker & MultiMeshBaker GameObject -> Create Other -> Mesh Baker -> TextureBaker & MeshBaker
    2. Add objects to combine. (Drag and Drop) For best results, these should use the same shader(s), but they don’t have to. Use the provided tools to make this fast and easy.
    3. Click ‘Create Empty Assets For Combined Material’. This will create material assets for the combined material(s) and also an MB2_TextureBakeResults asset that contains information mapping materials to UV rectangles in the atlases.
    4. Select shader on Combined Mesh Material. Mesh Baker tries to duplicate the material settings on the first object in the list of objects to combine. Mesh Baker will build a texture atlas for each texture property in this shader (main, bump, specular etc…).
    5. Set any options then click ‘Bake Materials into a Combined Material’.
    6. Look at warnings / errors in the console. Decide if action needs to be taken. Look at the combined material asset in the inspector to see that the generated atlases look correct. You may need to adjust non-texture properties in the combined material shader(s) to match the source material(s).
    7. If your meshes are distributed throughout the scene or clustered you may want to use the MB3_ClusterGrouper to group your meshes into multiple combined meshes. This will create several MB3_MeshBaker components.
    8. In the MB3_MeshBaker component click ‘Bake’. This will create the combined mesh and a new game object that uses it. The combined mesh is an instance (not an asset) so it can’t be used in a prefab. If you want to use the combined mesh in a prefab then select “output” -> “bake into prefab” (Create a prefab with an empty GameObject and drag it to the resultPrefab slot). The mesh will be saved as an asset and assigned to the provided prefab.
    9. (optional) Disable renderers in source objects.
     
    Goodgulf likes this.
  10. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    309
    @Phong

    I bought your marvelous asset a while ago but I just started using it. Congratulations, it seems to be really amazing!

    I have a little problem when combining the materials. Everything looks good but the eyes of my character become white and the hair has no transparency. If I just combine the meshes without combining the material it works great. So perhaps I am not doing the right thing with the transparent materials. Any help would be greatly appreciated, thank you.
     
  11. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Hi Netpost,

    I presume that the source materials for the eye and hair are transparent and all the other materials are not-transparent?

    You are probably not going to be able to combine the transparent with non-transparent materials. It is sometimes possible to combine these but there are usually a lot of technical problems. The combined material will need to be set up as a transparent material. The opaque parts of the combined mesh will need to have their alpha channel set to 0 so that they are fully opaque. Here are the typical issues:
    • Most transparent shaders don't look as good as opaque shaders when configured to be opaque
    • Transparent geometry needs to be rendered back to front. When triangles within a single mesh are rendered in the wrong order then the object doesn't look right.
    You can either leave the eyes and hair out of the bake, or use the multiple materials feature to map the eyes and hair to separate submeshes (multiple materials). You might be able to combine the eyes and hair into a single material if they are similar enough.
     
  12. Nico3D1982

    Nico3D1982

    Joined:
    Aug 14, 2017
    Posts:
    2
    Thanks for your great tool.

    I had 47 parts of mesh (for 1M vertex in total) and as much materials.
    • First, I succefuly generated Atlas 8K + normal map.
    • Then I combine my meshes (bake into prefab).
    Batches fall from 137 to 11 (!) and SetPass from 84 to 13.

    So i was excited unless i noticed Tris count jump to 1M to 8.2M !
    Do you have any idea concerning this ? (I'm using the free version but will surely buy the full one).

    Thanks for your help and have a great day.
     
  13. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    309
    @Phong Thanks for the quick reply.

    Not baking the eyes and hair is an easy solution thanks. I read the manual but combining materials is still new to me:

    I am able to combine all material into a single one
    I understand that I can remove the eyes and hair from the list if I don't want to combine them
    But I have problem understanding the multiple materials mapping to generate two combined material instead of only one. Is there an easy to follow tutorial on this subject?

    Thanks again!
     
  14. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,992
    Is is still possible to use this without texture arrays, but just a texture atlas?
     
  15. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Some jump in tris is to be expected, because separate meshes can be culled separately. When the separate meshes are combined, everything needs to be rendered if even a tiny part of the combined mesh is in the camera fustrum.

    Definitely do not combine meshes that will never be visible at the same time.
    Try to combine meshes that are close together. The Mesh Baker Grouper can help with this.
    Check the settings on the combine mesh. It may be that the shadow or light settings are different. This can cause extra shadow or light passes which can really boost the tris. The Frame Debugger can really help check if this is happening.
    Consider using the Batch Prefab Baker to make prefabs that share a material then use these in your scene instead of the original prefabs. Then make them static and Unity will static-batch them. These static-batch-combined meshes still do fustrum culling, occlusion culling and LOD. This technique can be very powerful.
     
  16. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Yes, most users are using texture atlases. You can decide which you want to use.

    upload_2021-1-8_13-19-53.png
     
    Lars-Steenhoff likes this.
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,992
  18. GameHourStudio

    GameHourStudio

    Joined:
    Apr 17, 2020
    Posts:
    104
    Hi, I am baking few meshes into combined skinned mesh and save the mesh as .asset as well .But when I try to export those skin meshes I get this error. upload_2021-1-9_20-32-53.png
    This is not the case when I bake the static mesh renderers. This only happens when I try to export the skinned meshes baked by mesh baker. I am using Unity FBX Exporter Package to do this. Thanks.
     
  19. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    151
    I have a number of problems. First, most of the textures are stretched. Second, when disabling the original meshes the colliders are no longer working. Third, the FPS in the scene has dropped from 60-70 to 5. Forth, when starting a scene it now takes 40 seconds to start (it used to take 5). Finally, the Unity editor is very sluggish. All of this happened after installing MB and baking my scene. There are no errors or warnings. Frankly, I have never been able to get MB to work properly in any project. My scene is quite large with close to 7000 meshes. I'm not one to give bad reviews since I believe in supporting the developers but I'm have not been very impressed. I'm really glad I backed up my project before I tried again with MB. I'm using Unity 2019.3.1f1.
     
    Last edited: Jan 10, 2021
  20. awais21

    awais21

    Joined:
    Jan 9, 2018
    Posts:
    31
    is there a way to combine juts the materiel of two meshes not the meshes
     
  21. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Hi GameHourStudio, With Skinned meshes you need to save the Mesh as an asset but also the bones (transforms). You will need to use the "Bake Into Prefab" feature. This will save a prefab with the bones and animator(s) as well as the mesh. You should be able to select that prefab in the project folder and FBX Exporter should work.
     
  22. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Yes, the easiest way to do this is to use the Batch Prefab Baker. It will generate a combined atlas material for a list of prefabs. Then create copies of these prefabs that use that atlas material.


     
  23. awais21

    awais21

    Joined:
    Jan 9, 2018
    Posts:
    31
    thnxs man lookin for this thing exactly
     
    Phong likes this.
  24. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Hi Nitrox32, sorry to hear that Mesh Baker is not producing good results for you.

    If the textures are stretched it could be that too many textures are being squeezed into an atlas. This often happens if textures are tiled many times. Do some of your meshes have a lot of tiling? I would suggest using several atlases and/or mapping the materials with heavy tiling to their own submeshes or even leaving meshes with a lot of tiling out of the bake.

    It sounds like you have a very large and complex scene. In this case Mesh Baking will probably not be an automated process. It is likely different parts of the scene will need to be handled with different approaches.

    Regarding the the drop in FPS and slow start up. Can you describe the workflow you used? Are you combining meshes in your scene or making prefabs that share materials? If you are combining meshes, how big are these combined meshes? When you combine meshes, are you combining all the meshes into one or a few combined meshes? Are the source meshes far apart?

    A likely possibility is that meshes that were cullable are now part of a few huge meshes and the number of verts and tris have gone way up. The MeshBakerGrouper can help with this, by helping you combine meshes that are close together.

    Another possibility is that the combined mesh is gigantic. Unity now supports meshes much larger than 64k. In my experience these meshes are slower than meshes around 64k.

    Another possibility is the render settings for the combined meshes. It could be there are more light and shadow passes.

    For very large scenes like yours it is a good idea to consider using the Batch Prefab Baker instead of combining meshes in the scene. Using the Batch Prefab Baker to generate prefabs that share materials allows Unity's build-in optimizations to be much more efficient. Rendering is generally more efficient because there is less need to switch materials/shaders/textures in the GPU but also static and dynamic batching become much more effective.
     
  25. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    98
    Hi, just a simple question, does Mesh Baker supports Unity URP and HDRP?
     
  26. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Yes, URP is fully featured. Some of the advanced HDRP features like Layered shaders using many different UV channels is not supported.

    The example scenes use the Standard shader by default and will appear Pink when first opened. The Examples folder contains Unity Packages for HDRP and URP. If you import the correct package the example scenes will work. We are currently adding a script to improve this process with the next version so the example scenes will update automatically.
     
    RiccardoAxed likes this.
  27. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    151
    Thanks for your response. There is a lot to unpack so I'll start with the easiest for me. Yes, all objects in the scene are cullable, should they not be?
     
  28. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Hi Nitrox, I am not sure what your scene looks like but given that it slows down a lot after combining it sounds like culling is very important.

    If this is the case then a good workflow is to create prefabs that share a material using the Batch Prefab Baker and use these in your scene instead of the original prefabs. You can turn on static batching for these objects and Unity will do the combining but it does it in a way that culling still works and LOD still works.

    You can alternatively use Mesh Baker to create combined meshes, but I would recommend using the Mesh Baker Grouper to group meshes that are close together in the scene. The Mesh Baker Grouper creates a Mesh Baker for each group.

    Speaking to optimization in general. A good place to start is the profiler (profile the build, not the editor). See what your bottlenecks are. A common bottleneck is rendering which is what Mesh Baker can help with. It may be that there are other systems that are slowing things down.
     
  29. awais21

    awais21

    Joined:
    Jan 9, 2018
    Posts:
    31
    while using "batch prefab baker" is there a easy way of adding prefab in "prefab slot". Adding prefab one by one is really painful.I mean the way we add objects just by selecting all the objects and then select the "add selected object" and it automatically add them.Is there any way of adding prefabs like this in "prefab rows"
    EDIT: I found my answer,my bad the options was already there
     
    Last edited: Jan 14, 2021
    Phong likes this.
  30. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    This is the workflow I use for this now if I am working with a game level. Will be making an updated video of this over the next month.
    • Use a TextureBaker and "Tools For Adding Objects" to find instances of prefabs in the game level
    • Add a PrefabBaker Component to the texture baker
    • Use the prefab baker button "Popluate Prefab Rows From Texture Baker"
    • Make a prefab of the TextureBaker/BatchPrefabBaker game object.
    • Move to a "Baking" scene
    • Instantiate the TextureBaker/BatchPrefabBaker
    • There is a context menu command (little gear) in the Batch Prefab Baker: Create Instances For Prefab Rows
    • Then add these instances to the TextureBaker and do the standared TextureBaker/BatchPrefabBaker workflow.
     
    awais21 likes this.
  31. draverik

    draverik

    Joined:
    Feb 17, 2019
    Posts:
    19
    Hello,

    I have a question about baking dynamic objects to skinned mesh renderer. It is great that I have 1 batch when I merge them but number of tirs is summed up and I cant disable objects that are far away. Any solution for this?
     
  32. PhilFaily

    PhilFaily

    Joined:
    Jul 31, 2017
    Posts:
    7
    Hi,

    I have several mesh bakes that are set to 'Preserve Lightmaps' which works great until I reload the scene and then the MeshBaked meshes lose their Lightmap information.

    Unity 2020.2.1f1
     
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    If the combined mesh is not huge it is reasonable to update it (remove the meshes). You need to do the original bake with "clear buffers after bake" unchecked. Then you can call "AddDeleteGameObjects" and "Apply". You can also try the "ShowHide" API which is a bit faster (note that this reduces tris, but leaves the verticies in the mesh which are still skinned ever frame so may be faster to bake but not to skin).

    Disabling objects in a combined skinned mesh is a problem. A hacky way to deal with it is to hide them by putting them somewhere out of sight (behind the camera). However this doesn't help with the overhead of having extra verts being skinned that are now not visible and extra tris that have some culling overhead.
     
  34. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    The "Preserve Lightmaps" is a bit of a hack I am afraid and Unity keeps changing how the lightmap baking works. I will need to look into how that works in 2020 now.

    The reliable method to handle lightmap baking is to use one of these two options when baking the combined mesh and then lightmap bake the result:
    • generate new UV2 layout
    • copy UV2 to separate rects (Use this if all your source meshes have imported UV2 not-auto-generated)
    You can lightmap bake the combined mesh after this.
     
    PhilFaily likes this.
  35. CJA_888

    CJA_888

    Joined:
    Sep 12, 2019
    Posts:
    15
    Hi,phong.i come again.haha.I ran into another problem.

    I have a lot of trees, but they all use UV1 and one texture for the top part, UV3 and another texture for the bottom part, and I've unified their shaders into one.Baker was able to place UV1 of each tree in the correct place of the texture atlases, but he couldn't separate UV3 into the texture atlases of the second posted image.
     
  36. CJA_888

    CJA_888

    Joined:
    Sep 12, 2019
    Posts:
    15
    Hi , phong.I see you reply above that baker do not support different channel UV, I hope you can upgrade when to support different channel.
     
  37. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    As I understand, your mesh uses UV1 and UV3 for albedo,bump,specular. These are layered/blended in the shader. Like detail maps, is this correct?

    At this time Mesh Baker only supports atlasing for UV1. If you are combining different meshes that use textures for UV3 /UV4, there is no easy way to combine these with Mesh Baker.

    I did start tinkering with a feature like this, but paused development because:
    • There appeared to be little demand for it (yours is only the second support request wanting this feature in several years)
    • The UI was very complex. I am worried most users will not understand the feature.
    • I was not sure how often users would be able to use it since all the source shaders would need to work the same way and use the same UV channels for the same purpose
    • All the situations I could find that use this technique (buildings, trees) use a lot of tiling which uses a huge amount of space in the atlases so it would only be possible to bake 2-3 different types of meshes together.
    Do you think you would use this feature often?
     
  38. CJA_888

    CJA_888

    Joined:
    Sep 12, 2019
    Posts:
    15
    Phone, thank you very much for your reply.



    Yes, as you said, I used different UV channels for the two texture. Because I find that using this texture gives my same object a rich look and a high resolution, and it's also a lot easier for me to create the texture. I think this is the future.


    Although MBaker does not currently support multiple channels, it is not unsolvable. My current method is to copy UV1 to UV3, then use Baker to make Texture Atlas, then I save the combined map and UV1, then I add them back to UV3. It's a bit of a hassle, but I found a way to do it.


    So I really hope you'll consider adding the multi-channel Texture Atlas feature to MBaker in the future. And I think this feature is very easy for you to implement.


    At the same time, you mentioned Baker UI, I think you can rest assured, I personally think MBaker UI is very good, although I was a little confused when I saw it at first sight, but now I use it very handy, ha ha.


    Thank you for your reply. I will always support and buy your products!
     
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Thanks for the information. I did suggest the approach to copying the UV channels to the other previous user who wanted this feature. It is useful for me to know how people use Mesh Baker and what they want it to be able to do. I love the look of your trees BTW. I agree that using extra UV channels in this way gets wonderful results.

    I will bump up the priority of this feature.
     
  40. zero3growlithe

    zero3growlithe

    Joined:
    Jul 7, 2012
    Posts:
    13
    Hi. I have a question regarding baking texture atlases and meshes in multiple unique (170 to be exact) prefabs. I want to combine each prefab's content into a new prefab (preferably with the same name), and not combine all prefabs into one mesh. Is there any way to make it painless?

    Because so far after evaluating the software and the documentation I found that manually creating mesh/texture bakers, empty prefabs and TextureBakeResult assets for all of the 170 prefabs seems to be the only solution. Am I missing something? Or do I have to write my own tool to deal with this?

    I found the included batch processing components to be of no use in this case.
     
  41. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    I don't believe that there is a fully automated workflow to do exactly what you want. I presume that the source prefabs include colliders and scripts? If so then I would suggest:

    First using the Batch Prefab Baker to generate duplicate prefabs that share a material. It will preserve scripts, colliders, LODGroups etc.. in your original prefabs. It will create texture atlases combined materials and adjust the UVs in the meshes. At this point the meshes within each prefab are fairly easy to combine because they already share a material. The problem is that there are so many of them. I would do the following either manually or using a script.

    • Create a single instance of each new prefab. Positions at 0,0,0, Rotation 0,0,0 Scale 111.
    • Create 170 Mesh Bakers
    • Drag the root of each prefab to the "objects to be combined". This will add all Renderers.
    • Bake all Bakers (select them all and click bake)
    • Move the combined mesh renderers for each baker to each prefab instance.
    • Disable renderers in source for all prefab instances.
    • Apply changes to each prefab.
     
    zero3growlithe likes this.
  42. awais21

    awais21

    Joined:
    Jan 9, 2018
    Posts:
    31
    first of all great asset,really amazed by the results.i have one confusion,when we combine the meshes using the
    Clustering Feature,now how i can manged the lods of the combined mesh,i mean what will be the proper way of using the lods feature on combined mesh thnx
     
  43. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    If the source meshes use LODs, then the best approach is to use the Batch Prefab Baker to create duplicate prefabs that share a material. You can use these in your scene in place of the originals and let static batching combine them. One nice trick of static batching is that LOD (and occulsion culling) still works even though the meshes are in a combined mesh.

    Alternatively, if the clusters are very small, you can use the "Cluster by LOD Level" checkbox on the Mesh Baker Grouper. This will bake all the LOD0 together, then the LOD1, then the LOD2. You can create an LODGroup for the combined meshes. Unfortunately the feature does not auto create the LODGroup for you. The results arn't super great because, if there is even moderate separation between the source meshes, the LOD level switching becomes very obvious.
     
    awais21 likes this.
  44. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    487
    Hello,
    i have 2 questions:
    My scene has been fully worked with LOD groups for objects,
    Should i separate manually each LOD0 from LOD1 and LOD2 ?
    cause they are listed together.

    i got unity to frozen during Analysing scene, i attached the screenshot.
    Is 45776 objects to much ? Screenshot at 2021-02-09 08 24 28.png

    Edit: After a small test in an empty project on small part of my level, i got it to freeze again, this time with only 143 objects...
    Screenshot at 2021-02-09 08 38 47.png

    Edit2: maybe it isn't frozen after all, maybe it is simply long to compute...
    Why does it takes so long for each model ?
     
    Last edited: Feb 9, 2021
  45. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Are you using the latest version? I made a change there that makes it work faster. The slow part was where it checks to see if triangles are shared by different submeshes. I removed that check.

    Regarding LOD groups. The best approach is to use the Batch Prefab baker to create modified prefabs that share a material. Then use static batching to batch them. The nice thing about static batching is that it still works with LOD and occlusion culling even though the meshes are combined.
     
  46. NathanJeeves

    NathanJeeves

    Joined:
    Jul 6, 2015
    Posts:
    14
    Hi there,

    Using mesh baker seems to have completely broke the zero points of the meshes I made with it,

    Help urgently needed, cheers
     
  47. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862

    Hi Nathan, the combined meshes will have pivots at 0,0,0 by default. This can be changed to pivot at bounds center (for the combined mesh) or a custom location in the MeshBaker settings.

    upload_2021-2-17_9-33-19.png

    Alternatively you can use the BatchPrefabBaker which does not combine the meshes. Instead it creates duplicates of your prefabs replacing the meshes and materials with new meshes that have UVs adjusted to share a material. These meshes will have pivots in the original positions. These new prefabs can be combined using Static or Dynamic batching.
     
  48. alphabean11

    alphabean11

    Joined:
    Apr 18, 2019
    Posts:
    18
    Hello! I am just about to buy this asset and I had a quick question. I have an entire scene built with a modular kit I made. Each asset is walls or pillars or floor or ceiling pieces and they are all prefabs. There are about 25 pieces in all. If I want to use mesh baker to combine my prefabs in my scene and all of the materials in the scene (they all use the same shader) will mesh baker be able to accomplish this without me having to make all new prefabs in the scene and rebuild? From the batch prefab combine it looked like I would’ve had to make all new prefabs.

    Another question as well, each of the buildings uses maybe 10 or so of the pieces, can I combine each building into its own mesh, and when I combine the building made of prefabs, will the texture atlas only contain each texture file once? Not once for each time the prefab shows up?
     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,862
    Mesh Baker has several different workflows. You could sse the basic workflow which is:
    • Add a texture baker to your game scene
    • Add all the meshes that use a reasonably similar shader (eg. opaque static objects using standard shader)
    • Combine textures into an atlas
    • Use the MeshBakerGrouper to create MeshBakers for each building or set up the MeshBakers manually (for example add all the meshes for one building to one baker.)
    • Bake all the bakers. You should end up with one combined mesh per building.
    Alternatively you could use the Batch Prefab Baker to create modified prefabs that share a single combined material. Mesh Baker now includes a tool to switch the instances in your scene with the new prefabs. We don't have a video showing how it works yet. Then you could use static batching to batch them or set up MeshBakers to combine each buiding.

    Re: Each texture appearing only once in an atlas. Mesh Baker tries very hard to be as efficient as possible. Most of the time a texture that is re-used on several objects will only appear once in an atlas. If there are multiple different meshes that tile a texture then Mesh Baker will shift and center the different tilings to find the smallest tiling block of texture that encapsulates all the tiling. However sometimes a texture will appear more than once. For example if two meshes use the same albedo but different normal maps then the albedo will appear twice in the atlas. Also if using the "blend non- texture properties" feature to blend color tints into an albedo texture, then the tinted-albedo texture will appear once per distinct color tint used.
     
  50. satyaloka

    satyaloka

    Joined:
    Dec 3, 2017
    Posts:
    2
    Hi, I'm trying your free version of MeshBaker. The performance impact is stellar! It bumped performance in mobile by roughly 15-20 fps

    However, probably due to baking, the scene file is bloated. My other Map Scene that is not baked, only has 2MB file size. The one that I baked got really big and now took 220MB.

    Am I doing anything wrong or is there a step I should have taken?
     
unityunity