Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  4. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

Mesh Baker by Digital Opus [RELEASED]

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

  1. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    When you add the meshes using this "http://screenshot.su/show.php?img=5d185418682e1fb6072ad4e510cfcd74.jpg". I see that exclude meshes with out of bounds UVs is checked. Try unchecking this and then adding the meshes. Also if you have some meshes with out of bounds UVs then you will want to use 'consider mesh UVs' on the texture bake.
     
  2. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    This is the expected behavior. Rendering performance can be improved by combining meshes, but for physics it is better to have many separate meshes. Also the source objects often have scripts that are triggered by collision events on the colliders on those objects. For this reason a good approach is to bake the rendered meshes together and disable or remove the renderers on the source objects but leave the colliders and scripts in place.
     
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I am not sure I understand the setup you are proposing. Physics colliders and Rendering meshes are completely separate systems. You can't use a skinned mesh as a physics collider. But you can add MeshColliders to each of the bones of your skinned mesh and they can be Physics colliders or triggers. The bones of a skinned mesh are just a game objects (transforms) in your scene. You can add scripts and components to these just like any other game object. You can also have skinned mesh that consists many meshes that have been baked together. The skinned mesh can use the same bones that the MeshColliders have been attached to. The skinned mesh component can be disabled without affecting the colliders.
     
    Ascensi likes this.
  4. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    You can move the entire combined mesh as a single unit. You can't move individual parts of a MeshRenderer mesh. You can also bake MeshRenderer meshes into a skinned mesh. Then you can move parts and still have a single draw call.
    You can add and remove parts of a baked mesh. So if there is something like a door that seldom moves then you remove it from the baked mesh, enable the source object for the door and move it at that time.
     
  5. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    420
    When people say "bones" I get confused as if they are talking about character bones -which I'm not, so you must be talking about something different. To be clear, I'd like to use the asset "fracturing and destruction toolkit" to fracture a rock and then bake all the rock fragments into a skinned mesh so that they can move independently - the fragments falling would be a simulated physics animation and all fragments inside the skinned mesh would have colliders, rigid bodies and a script making it so that if something new/not recorded as part of the physics simulation comes in contact with any of the fragments, "if fragment" contacts collider on layer "XXXX" then "unparent fragment" so it then runs on Unity's physics rather than continuing the animation. So I'm wondering if this is possible.
     
  6. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Yes, this is possible.

    Re: bones. Think 'bones are the Transforms/GameObjects used by a skinned mesh' to deform the mesh. They are called bones because most of the time skinned meshes are used for characters and bones is a good analogy. However all skinned meshes (like your fractured object) have transforms that are used to deform the mesh and these are also called bones. The are just GameObjects/Transforms.

    What you want to do is fairly straightforward.
    • Fracture your object into a bunch of meshes
    • Add these to a MeshBaker and bake them into a skinned mesh. Each source mesh fragment GameObject will become a bone.
    • Update the render bounds on the Skinned Mesh or add one of the scripts that updates it.
    • Disable or remove the MeshRenderers on the source fragments.
    • Add colliders and rigid bodies to the source fragments.
    Physics will animate the source fragment game objects which are also bones of the skinned mesh. The skinned mesh will deform to exactly match the falling fragments.
     
  7. Dogtanian

    Dogtanian

    Joined:
    Jul 9, 2017
    Posts:
    8
    Hi - could I please get some help with converting a skinned mesh renderer with BlendShapes into a mesh for use with a plain mesh renderer?

    I can easily do this for "normal" (no BlendShapes) skinned mesh renderers (your YouTube tutorials are great - thank you for these!), but for meshes with BlendShapes, I'm struggling to get the conversion to work. Explicitly, when I try and bake a skinned mesh renderer with BlendShapes into a mesh renderer, then the BlendShape values are ignored - I just get a mesh with all the default values for the BlendShapes.

    Is there a way to bake the deformed mesh (taking into account the BlendShape values) into a baked mesh for use with a mesh renderer and the two look the same (though obviously you can't then change the latter once baked)?
     
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I don't believe this is possible with Mesh Baker but you should be able to do it with the regular Unity API.

    https://docs.unity3d.com/ScriptReference/SkinnedMeshRenderer.BakeMesh.html

    You should be able to pose your skinned mesh and get a static snapshot using this method.
     
  9. Dogtanian

    Dogtanian

    Joined:
    Jul 9, 2017
    Posts:
    8
    Thank you for the quick reply - that API works perfectly for me.
     
    hopeful likes this.
  10. Dogtanian

    Dogtanian

    Joined:
    Jul 9, 2017
    Posts:
    8
    One other quick question - when baking lots of skinned mesh rendered objects together in a scene, my resulting mesh ends up with a significant number of "useless" verts/tris (where one object completely covers part of another, so a section would never be visible - for example, baking some clothing onto a human character means that the covered skin can never be seen). I'm not expecting MeshBaker to be clever enough to spot this and do any removal itself, but is it possible to save the baked meshes out in a format that can be edited in some third party program to optimize the baked mesh?

    For example, instead of MeshBaker saving out the combined mesh into a *.asset file, is it possible to save into some other format file (OBJ / FBX etc etc) so the baked mesh can then be manually edited?

    [or, more generally, does anyone know of any 3rd party tools that can take arbitrary *.asset files and export them? Note that I've tried things like ObjExporter, but they can't handle skinned mesh renderer objects - and just using the baked mesh in a mesh renderer object and exporting that obviously mangles them completely.]
     
    Last edited: Jan 1, 2018
  11. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I just tried Unity's new FBX Exporter. The good news is that this is created by Unity and they have access to autodesk sourcecode so it should work well. The bad news is that it exports Skinned Meshes as static meshes. There are a few FBX Exporters in the asset store but they are fairly expensive and I haven't tried them to see how they work with skinned meshes. I am hoping Unity will add proper skinned mesh FBX export functionality fairly soon. https://www.assetstore.unity3d.com/en/#!/content/101408
     
    Last edited: Jan 2, 2018
    hopeful likes this.
  12. Nemexyx-Lockheart

    Nemexyx-Lockheart

    Joined:
    Sep 10, 2015
    Posts:
    3

    Support unity 2017.3??
     
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Yes. Most of my development is done on the latest version of Unity and I port changes back. 2017 is definitely supported.
     
  14. supersolid-corentin

    supersolid-corentin

    Joined:
    Nov 1, 2016
    Posts:
    2
    Hi Phong,

    First, thanks for your work on this tool, this is very useful.

    I just wanted to report a bug. I have a lot of prefabs to process and some of those prefabs can have really weird configurations. One of them has a shader with 8 textures slots and is filled with only 3 textures in the third, fourth and fifth slots. I have to precise that I use the core API directly so TextureCombiner in this case. Unfortunately, when I try to create an atlas with this prefab, it generates a NullReferenceException in

    MB3_TextureCombiner.__CreateAtlasesUnityTexturePacker
    (ProgressUpdateDelegate, int, List<MB_TexSet>, List<ShaderTextureProperty>, bool[], Material, Texture2D[], MB2_EditorMethodsInterface, int) line 1654.

    My fix was to replace 'i == 0' with 'uvRects == null'. It seems to work but I'm worried that it may break somewhere else. If you could have a look and tell me if there's a better fix or if I need to fix something elsewhere, I would definitely appreciate.

    And I also wanted to give you a small feedback about a potential missing feature. A lot of my prefabs have textures using clamp as wrap mode. So there's dark edges appearing on meshes using those textures in the atlas. So I have duplicated the pixels at the texture edges to simulate the clamp mode. Maybe I'm missing something in the configuration to do the same? If not, that would be awesome to add an option to support that as I think a lot of textures are used that way.

    Thanks for the support!
     
  15. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Hi supersolid-corentin, thanks for reporting this issue.
    I looked into the NullReferenceException issue, but could not find the code "i==0" in the function __CreateAtlasesUnityTexturePacker. Are you using the latest version of Mesh Baker? There is a variable with the version number in MB3_MBVersionConcrete.cs.
     
  16. Alexandre-Vinet

    Alexandre-Vinet

    Joined:
    May 23, 2013
    Posts:
    4
    Hi, I am using the "Blend Non-Texture Properties" option. The baked result has greatly different Smoothness and Normal results than the original. Is there a version of the TextureBlenderStandardMetallic.cs for Unity 2017 that supports the Smoothness slider (multiplying the Alpha of the Metallic texture) and the Normal float ( blending the Normal map toward blue ) ? Thanks!
     
  17. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I will take a look.
     
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    That should work for mecanim characters since the batch prefab baker creates a duplicate of the original prefab and only switches the mesh and material. Can you tell me which version of Unity you are using? Do your skinned meshes use blend shapes?
     
    lod3 likes this.
  19. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    592
    Sorry, deleted my post! The process is more involved than I thought, but I understand now. If I run into any issues I will let you know.
     
  20. AnneDraaisma

    AnneDraaisma

    Joined:
    Jul 14, 2014
    Posts:
    11
    Hello,

    I would like to bake non-texture properties (_Color, _Metallic, _Glossiness and _Emission). When the materials use the Standard (Specular) shader, this works as expected. The TextureBlender creates the correct texture atlases for each property.

    However, when the materials use the Standard (Metallic) shader, the TextureBlender creates a texture for each property, except for _Color. Is this a bug or do I need to set things up differently for the Standard (Metallic) shader?

    Thanks in advance!
     
    Last edited: Feb 7, 2018
  21. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    78
    Totally new to MeshBaker and trying to get my head around Prefab Baker and how/when I should use it.

    I've baked my main level geometry (all set static and atlased) great :)

    I have 'pick-up' prefabs that are spawned into the scene randomly. These are made up of various child gameObjects - some are meshes, some empty GameObjects with scripts and/or Trigger Colliders, some lights.:[​IMG]
    NB. some of these have animations, so for example in the example above, the cabinet doors open when player enters a trigger.

    So my initial thought was to atlas all the textures into a single textureBaker asset (for all of the pick-ups element used in the level) and then to create individual meshBakers to combine the geometry within each 'pick-up', e.g. the cabinet, the pile of ammo boxes, etc. (there are others not shown) The cabinet actually uses three because it needs a separate mesh for each moving door; each door and its handle are combined:
    [​IMG]
    Having done these mesh bakes I intended to make these into prefabs by dropping them into my Project folder. As you explain in one of your videos I assumed I would simply reuse the same TextureBake asset across all of these prefabs.

    But then I came across your video tutorial for Prefab Baker and was wondering if I should be using that instead?

    Can you clarify its usecases and what the difference is to doing it as explained above?

    My goal is to minimise drawcalls, while still being able to spawn each 'pick-up' prefab (collection of geometry and scripts)

    I hope all that makes sense! Any help and guidance would be very much welcomed. Thanks!
     
  22. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I will take a look. Sounds like a bug.
     
    AnneDraaisma likes this.
  23. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    The use case for the Prefab Baker is to convert prefabs that do not use atlased materials to prefabs that use shared atlased materials. There are two major benefits to this:
    1) Unity's Static and Dynamic batching become dramatically more effective. IMO this is the single best way to boost performance.
    2) Combining meshes becomes much easier. You don't even need to use Mesh Baker if the meshes already use a combined material. You can use the Mesh.CombineMeshes API.​
    Usually you would use the Batch Prefab baker before you begin to assemble your scene.

    The approach you describe above: Combining a pile of assets in a scene into a single mesh is also a good thing to do as it can significantly reduce drawcalls. You could convert the generated combined mesh into a prefab. I would recommend using the 'bake into prefab' option in the baker instead of dragging the generated meshrenderer into the project. The problem with dragging to create the prefab is that the Mesh is not an asset, it is an instance in the scene. The mesh gets lost. The Batch Prefab baker would not help in this process. I would recommend using the MeshBakerGrouper with agglomerative clustering to efficiently group objects in your scene that are close into bakers.
     
  24. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    78
    Thanks @Phong So it sounds as if I'm going about it the right way (I am using 'bake into prefab', then taking all the bits and turning that into prefabs (essentially the meshBaker assets become nested prefabs).

    I've used MeshBakerGrouper while optimising general scene geometry but I need more control with these pick-up prefabs, Choosing for myself what should be included makes more sense to me in this instance.

    However, I'm still not sure I understand why Batch Prefab baker differs from this process. Sorry! I don't mean to be a pain, just trying to understand :) So I take the meshes and atlas them together then combine the meshes (prefabs into assets) Isn't that what you describe for the Batch Prefab baker?
     
  25. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Hi Jerome,

    The workflows are different.

    The Batch Prefab baker works on Prefabs in the project folder, not scene GameObjects. It is best used on prefabs before building levels. Art model prefabs can come from many sources: Asset Store, Other Projects, Different Artists. it is very unlikely that these will share a atlas. The Batch Prefab Baker converts these prefabs into prefabs that share an atlas. The meshes are not combined, but their UV channels are modified to share an atlas. When putting a level to together you would use the versions of the prefab that use an atlas. If a source art model gets updated then you just rebake the prefabs using the Batch Prefab Baker.

    The other workflow you describe is for converting scene object combined meshes into Prefabs in the project folder. You would use it if you created a combined mesh from some scene objects, (eg. a pile of cannonballs) and wanted to re-use that pile in places in the game. Then you bake into prefab and re-use that prefab elsewhere.

    Does this make sense?
     
    jeromeWork likes this.
  26. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    78
    Thank you for taking the time to try to explain this so well (the cannonball example really helped). I'm still feeling totally stupid for not really seeing the subtle differences between the two methods. Seems as if I'm doing a bit of both, but definitely mesh combining so I guess I'll stick with my original method.

    I'm guessing this will all become crystal clear the more I use MeshBaker as part of my development work. And then no doubt I'll feel even more stupid for not having understood what you meant :)

    Got to say... I've used other optimization tools in the past. Was kind of put off by the relatively high cost of MeshBaker (for a hobbyist like me anyway) but massively regretting not having bit the bullet much earlier. Your asset is really a joy to use.

    Can I ask another quick question?... are there any potential issues with combining and atlasing already combined/atlased assets. I'm guessing it's best not to, but just in case I ever have to...
     
  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    If you are thinking about assets from the Asset store that use an atlas, you should definitely consider combining them. Consider for example adding a flower pot that uses a tiny part of a huge atlas, and nothing else in your scene uses that atlas. This is very wasteful. The 'Consider Mesh UVs' feature will extract only the part of the huge atlas used by the flower pot and add only that to a new atlas. This new atlas will only contain textures that your scene actually uses.

    Don't ever feel stupid for asking questions. Your questions are good ones and insightful.
     
  28. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    234
    hey,

    - Will you support combine meshes with vertices greater than 64k on 2017.3 ?
    - do I need to buy mesh Baker LOD to support LOD on combined mesh?
    - At runtime when I am combining with Mesh baker, it augment the number of tris/vertices quite a lot!

    here the result:

    Mesh baker disabled:

    triangles : 57.8k
    vertices : 44.2k
    batches : 123

    Mesh Baker enabled:

    triangles : 524k
    vertices : 361k
    batches : 22

    Am i doing something wrong? FYI I am destroying the original mesh filter and all other components, just to be sure.

    thanks in advance
     
    Last edited: Feb 13, 2018
  29. supersolid-corentin

    supersolid-corentin

    Joined:
    Nov 1, 2016
    Posts:
    2
    Hi Phong,

    I have checked MB3_MBVersionConcrete and it tells me I have the version 3.23.3. I am using Unity 5.6 though so maybe there's a difference compared to the package for Unity 2017.
     
  30. silvershunt

    silvershunt

    Joined:
    Dec 21, 2016
    Posts:
    42
    I'm currently following the AngryBots tutorial and seems like the "Generate Mesh Bakers" button is missing on the Analyse Scene & Generate Bakers window. Or the process of baking hundreds of objects is different now?

    Right now, what I'm doing is click the List Shaders in Scene button, then click the "Generate Baker" button on each seach results. But the problem is I got a lot of shaders on the scene so its not very practical workflow.
     
  31. silvershunt

    silvershunt

    Joined:
    Dec 21, 2016
    Posts:
    42
    Mesh Baker Grouper is only for baking meshes based on distance / proximity.
    What if I want to bake meshes based on identical shader / material?

    I have to manually group the meshes by "shader", then manually click "Generate Baker" for each group of meshes.
    Where can I find the "Auto Generate Bakers" section on the Analyze Scene window?
     
    Last edited: Feb 13, 2018
  32. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I do intend to support mesh with more than 64k soon.
    You can use the combined mesh in an LOD without Mesh Baker LOD. Mesh Baker LOD is designed as an alternative to Unity's LOD system.

    When combining meshes it is important to group meshes that are close together or would be visible at the same time. If non visible meshes are combined with visible ones then the GPU will need to do a lot more work dealing with off screen geometry.
     
    blitzvb likes this.
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    I replace the global "Generate Mesh Bakers" button with the current approach. This decision was made because I found that in most cases there were a lot of groups in the scene that I didn't want to generate bakers for and would need to delete these after they were generated. I will try to re-add the generate all bakers button in a future release.
     
    silvershunt likes this.
  34. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    You can use the grouper to generate generate a single baker by setting the cluster type to 'None'. Also, when the TextureBaker is generated using the "Generate Baker" button it has a MeshBaker object as a child. This mesh baker will combine all meshes in the TextureBaker "Objects To Be Combined"
     
  35. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    87
    I used Mesh Baker to combine a bunch of metallic ventilation ducting in one of my scenes and after doing so the metallic look of the combined object is missing, it's like it has lost it's metalness and reflection and has become kind of like flat shading. I've attached the material being used. I've also attached the bake options for this.

    upload_2018-2-14_3-58-30.png

    upload_2018-2-14_3-59-16.png

    What am i doing wrong that is making the metal look of the material disappear when I do a light bake. It all looks fine in a light baked scene when not combined, just after doing so it's messed up and flat non metallic looking. If I shine real time lights on it then it looks metallic, I think the reflections are not working on the material, it has refelction probes etc it just doesn't appear to be doing any reflecting, I must be doing something wrong, not checking an option or something?
     
  36. silvershunt

    silvershunt

    Joined:
    Dec 21, 2016
    Posts:
    42
    Thank you. That way, we'll have an option to quickly generate bakers.
    Also would it be possible to make the Shader / Material field on the Search For Meshes to Add window, as Lists so I can drop 2 or more materials to add meshes to a particular baker? Or there's already a way to do it?
     
  37. silvershunt

    silvershunt

    Joined:
    Dec 21, 2016
    Posts:
    42
    Check if the resulting Combined Material is the same shader from the original meshes with the metallic shader parameters. You probably combined different shaders / materials and the Combined Material ended up differently.
     
  38. silvershunt

    silvershunt

    Joined:
    Dec 21, 2016
    Posts:
    42
    Yeah, grouper is really an awesome feature. Saves lot of time from manually selecting meshes.
     
  39. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    234
    awesome for the 64k vertices. looking forward to it.

    For the numbers that augment after a combine. All my meshes are visible. See those screenshots:

    Not Combined:

    Capture-without.PNG

    Combined: Capture-mb.PNG

    I combine like that:

    public void MBCombineAll() {
    Debug.Log("Mesh Baker Combine All...");

    meshbaker.AddDeleteGameObjects(objsToCombine.ToArray(), null, true);
    meshbaker.Apply();

    }

    Furthermore, when I am trying to combine LODGroup gameobjects, I got errors because Mesh Baker is expecting a meshrenderer. Should I give to the addObject function the first LOD?

    thanks in advance.
     
    Last edited: Feb 14, 2018
  40. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    592
    Noticed the "MCS". Are you also using Mesh Combine Studio? Lot of users of that asset are complaining about increased vert and triangle counts.
     
  41. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    234
    yes it does increase triangles and vertices too but less. The problem is that MCS is not mature and not supported anymore :/ so I have to move away from this asset. Though, there is one cool feature that enable you to combine over multiple frames and I am not sure MB can do that ...
     
  42. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    87
    I only combined meshes using the same material and shader and the resultant mesh is using the same shader with all the same parameters.
     
  43. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Hi Catfink, the most likely problem is that combined material is not using the shader you want. Mesh Baker creates atlases for the texture properties in the combined material. Also try fiddling with the 'non-texture properties' on the combined material. Mesh Baker tries to set these but it is very challenging to guess right in all cases.
     
  44. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Hmm, these numbers look a lot more reasonable than the numbers in your first post but it is interesting that they are higher. Check the settings on the combined mesh renderer to see if it is set up the same as the source renderers. In particular check how it is lit and how it is handling shadows. It looks to me like there is an extra rendering pass, perhaps another light or shadows being generated?
     
    blitzvb likes this.
  45. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    The next thing to check is the name of the properties. There is not way to query for these in a material so MeshBaker has a list of common property names that it tries to see if they exist in the material. Your shader may have a material that is not on that list. You can add it in the list of 'Custom Shader Property Names'. Be sure to add the name of the property in the actual shader file, not the name that appears in the material inspector.
     
  46. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    234
    spot on! the cast shadow is set to on after a combine. if I set it to false like on the prefab, the number of triangles/vertices stay the same. yeah! so I guess it's normal or I can I do something about it?

    For LOD support and combining LOD, I do not see any API or documentation on that mater. how should I proceed?

    thanks in advance.

    Vincent
     
    Last edited: Feb 15, 2018
  47. tanadol

    tanadol

    Joined:
    Dec 21, 2016
    Posts:
    1
    Hello Ian,
    Can I request an option to bake a skinned mesh (with texture atlast) and reserved all submeshes structure?
    The situation is ...
    1. I make a model with multiple mesh for cloth/short changing
    (Group030 has 4meshes each attached to different bones)
    [​IMG]
    2. If I bake this model WITHOUT texture atlas(Created by texturebaker).
    The baked skinned mesh result has submeshes(reserved by different material). which is good for animation
    [​IMG]
    3. But when I want to use texture atlas(Created by texturebaker),
    The baked skinned mesh result has combined all submeshes into one mesh,Therefore, my animation avatar is broken.
    [​IMG]

    Is there any option to keep the submeshes structure, or any workaround to solve this problem?
    Being a programmer, I'm quite new to modelling and animation so any suggestion would be very kind.
    Thank you
    Tanadol
     
  48. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    592
    The Batch Prefab Baker is what you're looking for.

     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    At this time LOD support is somewhat limited. You can add all of the meshes used by a set of LODs to the TextureBaker. In the MeshBakerGrouper you can check 'Cluster by LOD level'. This will put all the LOD0 meshes in one MeshBaker baker, the LOD1 meshes in another mesh baker, the LOD2 meshes in another. After they are baked you will need to set up a new LOD object with the new combined LOD meshes.
     
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,263
    Hi Tanadol, I am confused about why the submeshes/multiple materials are necessary for the animations. In most cases the animations just move bones around and don't care about which submeshes exist?

    Anyway you can preserve the submeshes using the 'Multiple materials" feature. You will need to create a combined material for each of your source materials and map the source materials to the combined materials.

    Note that each submesh requires a setpass call so there is very little performance benefit to combining the meshes if you are not going to combine the materials.