Search Unity

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,540
    New version of Mesh Baker available 3.27.1!

    This version includes improvements to the MeshBakerGrouper workflow.

    1. The Pie grouper now has rings as well as segments and all segments in the inermost ring can be combined into a single segment. (Thanks for the suggestion @nickrart ).
    2. Settings used by a MeshBaker can now optionally be stored in a ScriptableObject asset. These can be shared by many MeshBakers, MultiMeshBakers, MeshBakerGroupers in different scenes. When creating MeshBakers from a MeshBakerGrouper, the children automatically inherit the settings from the MeshBakerGrouper.
    3. It is no longer necessary to manually delete child MeshBakers when re-generating a cluster. This is now automatic.
    4. A bug fix for normals when baking meshes with non-uniform scaling.
    5. A bug fix for the Standard shader when maps have different tiling settings.
     
  2. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,234
    I'm new to Mesh Baker
    I don't understand what this error means

    Source object Back_Stand used a material Ancient Stone Tile Set 6 (UnityEngine.Material) that was not in the baked materials.

    Also was trying to find it in the guide
    whats the difference between the 3 Output Modes?

    I have a prefab that I dragged into Mesh Baker
    I want to replace this prefab though with the combine mesh.
    what option do I select for that?

    I already placed this prefab in my scene a ton of times so I don't want to create a new prefab.
     
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Regarding the first error. With Mesh Baker workflow you first create a combined material from several source materials. Then you can combine any meshes that use any of the source materials. The error indicates that you are trying to combine a mesh that does not use one of the source materials. If this is unclear I would recommend watching this tutorial.



    To bake your prefab you may want to use the Batch Prefab Baker workflow for creating modified versions of your prefab that use a combined material. You mention that you don't want a new prefab that needs to replace an existing one in your scene. This can be accomplished by:

    1) Using the the Batch Prefab Baker
    2) Duplicate your prefab, use the duplicate as the source (input) and the original as the output.

     
  4. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    77
    Hi.

    I am having a consistent issue, trying to use MeshBaker.

    Note this screenshot:

    upload_2019-5-11_20-4-31.png

    This is what happens, every time I try to run something through Mesh Baker: it creates a material that looks fine in the project folder, but when I try to make the meshes/prefabs/what have you, it comes out with the materials placed haphazardly.

    This happens whichever MeshBaker component I use, with the exception of the simple "MeshBaker." however, that just results in a clumsy duplicate of the original, with zero improvement in performance. How do I get around this?

    Apologies if this has been brought up before- if so, a link to the solution would be appreciated.

    Thanks for any assistance you can provide!
     
  5. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    I think you are running into issues with Tiling. Check the log after baking the textures. There will probably be some warnings mentioning UVs outside the range 0..1.

    I would suggest watching this video. It describes the problem and several solutions for dealing with it.

     
    eblumrich likes this.
  6. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    831
    does it work with Unity 2019?
     
  7. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, I have tested in in Unity 2019.
     
  8. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    77
    K- got confused, early into the process, as the first solution offered in the video (fix out of bounds UV) doesn't seem to be in the build of MeshBaker I am using- I just updated, so that's rather odd- is the video old?

    See screenshot attached.

    I tried using "consider mesh UVs" as you can see- it did lead to a slightly better result, but the textures were still a bit "off."

    The compiler didn't have any issue that resembled the one featured in the video- the one that offered solutions- that wasn't there, in any of the bakes I created...

    As the "like with like" solution requires the same, I'm sorta stuck...

    Thanks for your help- hope we can get this figured out!
     

    Attached Files:

    • 1636.jpg
      1636.jpg
      File size:
      219.1 KB
      Views:
      102
  9. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, it is an old video (apologies). The "Consider mesh UVs" is the new name for the feature. What do you mean when you say the textures were "off" were they positioned badly or were the colors/appearance different?
     
  10. ChrisVitei

    ChrisVitei

    Joined:
    Sep 18, 2013
    Posts:
    4
    This might be answered somewhere in the thread, but can I use MB to atlas the textures/combine materials and re-assign the UVs on multiple meshes *without* merging the meshes into a single giant one?
     
  11. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, the easiest way to do this is to use the Batch Prefab Baker:



    If you need more control you can use a mesh baker and set the Output = "Bake Mesh Assets In Place". Although the setup is a bit trickier.
     
    ChrisVitei likes this.
  12. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    77
    Hi! i having a weir issue when combining common meshes using the "bake into Skinned mesh renderer" option.

    When i do the Baking and the combined mesh is created. if i disable the source mesh then i cant move independently each asset, as you show in your video) they work as a normal mesh renderer.

    But if i enable the source meshes then i can move each one independently but there is a weir flickering in the mesh, because the two assets are been drawn overlapped, the source and the baked skinned one.

    What i want to achieve is: i have a lot environmental assets that cant be light mapped due performance issues, so they will work with light probes but also i want to bake them together, so the best option was using the bake into skinned mesh renderer so each one remain "independent" for light probe use. But im getting that weird behavior.

    Basically i want to do what you do in your videos with the dices.

    this in unity 2019.1


    I will attach a small scene where im testing.

    Thanks!
     

    Attached Files:

    Last edited: May 16, 2019
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540

    Can you confirm that the mesh combining was successful? There should be a log message in the console after baking the mesh. Something like:

    Successfully baked 16 meshes.

    There should be a CombinedMesh-MeshBaker object in the scene. Check that this object has a child and that the child has a SkinnedMeshRenderer.

    Try "disable renderers on source objects". Now do a few tests.
    - Select some source renderers and check that the MeshRenderers are indeed disabled.
    - Try moving some source trees. They should visibly move (this should be the combined mesh).
    - Try disabling the combined mesh. The trees should vanish.
     
  14. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    77

    Hi! Thank you for the fast response.

    "Can you confirm that the mesh combining was successful? There should be a log message in the console after baking the mesh. Something like:

    Successfully baked 16 meshes."

    Yes the bake is successful

    "There should be a CombinedMesh-MeshBaker object in the scene. Check that this object has a child and that the child has a SkinnedMeshRenderer."

    Yes, this is also correct

    "Try "disable renderers on source objects". Now do a few tests.
    - Select some source renderers and check that the MeshRenderers are indeed disabled.
    They are indeed disabled.
    - Try moving some source trees. They should visibly move (this should be the combined mesh).
    They move correctly
    - Try disabling the combined mesh. The trees should vanish."
    They vanish as you say.

    To my understanding, if all these test are correct, then the tool is working properly, now the individual objects are not interacting correctly with light probes, the light probes are interacting like if it was a huge mesh (this is understandable since the meshes all are baked into one single skinned mesh), is there a what to make possible to make each individual asset have their own anchor point for light probes?

    Thanks!!
     
  15. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Re: the light probes, I don't know of a way to make different parts of the model use different anchor points. :(
     
  16. CGBoy

    CGBoy

    Joined:
    May 25, 2017
    Posts:
    4
    Hi, after I merged the characters, I want to modify the material of one of the characters. What should I do?For example, if a monster is hit, the monster needs to show the effect of hit turning red
     
  17. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    When you bake the Textures/Materials include an extra copy of the character with the damage material. This way the red textures will be included in the atlas.

    When you bake the Meshes, you can uncheck "clear buffers after bake". If you do this then Mesh Baker retains the buffers containing the vertex layout for the combined mesh. You can "update" the material on a character by switching the material on the source character (with the disabled renderer) and calling MeshBaker.Update(....) include only the character with the damage texture as an argument.

    There is an example scene, I think it is called UpdateTextures, that does this.
     
  18. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    77
    See below- this is what happens, when I try to implement solution 1.

    upload_2019-5-20_13-14-59.png

    As you can see in the image below, I attempted to create an atlas material, "mb2"- you can see in the "main" slot that it has essentially tossed out every texture, with the exception of the tiled roof.

    upload_2019-5-20_13-17-39.png

    In the screenshot below, you can see the settings:

    upload_2019-5-20_13-19-2.png

    Thanks for your assistance in figuring this out! Hopefully, we can find a solution!
     
  19. CGBoy

    CGBoy

    Joined:
    May 25, 2017
    Posts:
    4
    I'm sorry, I don't quite follow you. Do you have any examples
     
  20. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Check some things:
    • Are there any warnings or errors when you bake the textures. Mesh Baker is very good about printing warning and error messages.
    • Are all the objects added in Objects To Combine?
    • Do some of the source materials have missing textures (color only)? If so then try checking "blend non texture properties".
    • Do some of your shaders use different texture property names? For example one shader might call the texuture _MainTex, another shader might call the texture _ColorTex. If this is the case I would recommend temporarily switching the shader on your source materials so that that they all use the same set of property names. Also Mesh Baker looks for the property names used by the Standard shader. If your source shaders used different property names you may need to add your names to the list of CustomTexturePropertyNames
     
  21. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Hmm, there is an example scene called SwitchBakedObjectsTexture, but I see that it is only in the 5.x asset store version and not the 2017+ asset store version. PM me an email address and I can send that to you as a Unity package. Will be sure to fix that in the next release.
     
  22. CGBoy

    CGBoy

    Joined:
    May 25, 2017
    Posts:
    4
    Ok, thanks. Here is my email address:chenximincool@163.com
     
  23. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Sent the example scene.
     
  24. CGBoy

    CGBoy

    Joined:
    May 25, 2017
    Posts:
    4
    I have some question, Fbx must open Read/Write enabled on bake the mesh dynamically at runtime. Does this make memory usage high? And switch baked objects texture use AddDeleteGameObjects method, Does it cause performance problems?
     
  25. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    The extra memory for a readable 64k mesh is about 17meg for a typical mesh (verts, normals, tangents, UV). Note that there is only one of these in memory even if you have many instances of the mesh in your scene. If your meshes have fewer vertices then the memory impact will be lower.

    Combined meshes are probably a bigger memory concern. Each source mesh instance has its vertices baked into the combined mesh so if you have hundreds of copies of the same source mesh, you will have hundreds of duplicated vertices. This can add up.

    Re: switching bake object textures. This is a fairly fast operation. However it requires the Mesh Baker to maintain a set of buffers of the combined mesh which doubles the memory needed for the combined mesh.
     
  26. VagantB

    VagantB

    Joined:
    May 28, 2019
    Posts:
    5
    hi,
    we use your meshBaker a lot in our project.
    Now we come across a problem with prefabs.
    We change something inside off a prefab (added some meshes).
    If we reuse the textureBaker ("Bake Materials Into Combined Material") and then reuse the MeshBaker("Bake") sometimes the "Clear Buffers After Baker" seems to get ignored.
    The Debug-Inspector safed all "verts" after the baking. (see Image)
    This way, saving in the prefab costs a lot of time.
    But we don't want the TextureBaker+MeshBaker(the empty's with scripts) erased from the Prefab.
    In your Tutorial Combining Textures into Atlases (8:55min) you doing exact what we wanna do.

    Sorry,
    if the problems solution is already explained somewhere (didn't find it) and sorry for the bad english.
     

    Attached Files:

  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Hello,

    It sounds like the problem is that you want to clear the buffers after bake, but this is not happening. The vertices are being saved which is taking a long time. Is this correct? If so I will look into the issue.
     
  28. VagantB

    VagantB

    Joined:
    May 28, 2019
    Posts:
    5
    yes,
    that's the nearly the issue,
    but its a problem with the Verts, Normals, Tangents and Uv's too,(image1)
    he just doesn't clear them always.
    so the prefabs we use getting real big.

    thanks for your work
     

    Attached Files:

  29. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    A did some quick tests but so far have not been able to reproduce the issue.

    What version of Unity are you using? Also is this the latest version of Mesh Baker 3.27.0?

    I think if there is an error baking one of the prefabs then the clear buffers may not execute. Are there any errors?
     
  30. binho123

    binho123

    Joined:
    May 28, 2019
    Posts:
    12
    I have some objects in my scene that have their own atlases. They use the same shader. I want to combine these atlas textures in a bigger texture to reduce the number of draw call batches.

    I was able to create such atlas/material, but then I have to replace the material in the objects and it obviously doesn't work because of different UV.

    So I assume I have to create new meshes that uses the new material. But I don't want to combine the meshes into one giant mesh and I don't want to combine into group meshes. I have many repeated meshes so I don't think it's a good idea to combine.

    I just want my objects to use the new material. Is there a way to do that?
     
  31. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, you want to use the Batch Prefab Baker.



    You also might want to use the "consider UVs" feature. When you use this, only the part of the source atlas that is actually used by your meshes is copied to the combined atlas. This is great if your source meshes only use a small part of your source atlas.
     
    binho123 likes this.
  32. binho123

    binho123

    Joined:
    May 28, 2019
    Posts:
    12
    Thank you @Phong , this seems to be what I need indeed. I've watched the video.

    I have another problem, though: the artist who created the scene unlinked the scene objects from their corresponding prefabs. I have dozens if not hundreds of game objects that are probably exactly like their prefabs but are not linked. Is there anything I can do in this case?

    Also, if I had a scene full of objects linked with their prefabs, would I be able to replace the old prefab instances with the new prefab instances without fixing the scene manually object by object? Perhaps having the out prefab pointing to the in prefab in the Batch Prefab Baker?
     
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Re the unlinked objects in the scene. You would need to re-link the prefabs either manually or write a script to do it.

    Re: how to handle prefabs that have already been placed in the scene. You can do exactly what you describe. Duplicate the prefabs and use the duplicates as the source and the originals as the "out prefabs"
     
    binho123 likes this.
  34. VagantB

    VagantB

    Joined:
    May 28, 2019
    Posts:
    5
    hallo again,
    we using unity version 2018.3.14f1 and MeshBaker Version 2.27.1 May 7 2018.
    the only error we encounter is becuase of the overwrite in the prefab.
     

    Attached Files:

  35. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Hmmm, thanks for the clue. I think that may be the problem. Will investigate.
     
  36. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    @Gort123 I still can't replicate the issue. Is it possible for you to send me a project with a simple scene that generates this error?

    I suspect it is related to nested prefabs somehow but in all of my experiments I can't get it to happen. Are your source prefabs part of a larger prefab?
     
  37. TriangleSybren

    TriangleSybren

    Joined:
    Apr 30, 2019
    Posts:
    3
    Hi Phong,

    I updated to your latest version of Mesh Baker (3.27.2) in our Unity2018.4.0f1 project and encountered a lot of warnings of obsolete methods such as

    MeshBaker/scripts/Editor/core/MB3_MeshBakerEditorFunctions.cs(188,128): warning CS0618: `UnityEditor.ReplacePrefabOptions' is obsolete: `This has turned into the more explicit APIs, SavePrefabAsset, SaveAsPrefabAsset, SaveAsPrefabAssetAndConnect'


    I think in most cases it just requires an update of the method to call.
    I was just wondering if you knew about this and if you happen to have a release planned that fixes these warnings
     
  38. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, I do plan to address these. The warnings appear in 2018.3+ (anything with the new prefab system). The old API still works so I haven't implemented the new prefab API for 2018.3+ yet but it is on the TODO list.
     
    Xarbrough likes this.
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    I released a Mesh Baker bug fix release that fixes an issue in version 3.27 where UnityEngine was not enclosed in #if UNITY_EDITOR which prevented projects from building.
     
  40. nova234

    nova234

    Joined:
    Feb 19, 2018
    Posts:
    7
    Did Mesh baker works with Unity 2019.1 and LW RP ?
     
  41. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    63
    I have Unity 2019.1.4f1 using a standard 3D project and I am on Mesh Baker 3.27.2. I am attempting to follow this Youtube tutorial:



    Which was a tutorial created in nov '18 to correct a jaw issue on an iClone Character Creator 3 model. CC3's exporter has an issue with the jaw being permanently open when importing the character into Unity that this video helps correct so that features like lipsync will work properly.

    However, when I attempt the mesh baker step to combine the Body, Tongue and Teeth blendshapes into a single combined mesh using the MB3_Multi Mesh Baker I receive an exception that a key could not be found in a dictionary in MB3_MeshCombinerSimple.cs.

    Specifically "InstanceID in blend shape that was not in instance2combinedMap" is the issue that is cropping up. Any thoughts on how to fix this so I can proceed? It seems to have worked for the youtube tutorial creator in an older version of Mesh Baker. Thank you for your help.

    Edit 1: I went ahead and created a Unity 2018.4.0f1 LTS standard 3D project and confirmed the exception also occurs there as well.

    Code (CSharp):
    1. System.ArgumentNullException: Value cannot be null.
    2. Parameter name: key
    3.   at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00008] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
    4.   at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00000] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
    5.   at DigitalOpus.MB.Core.MB3_MeshCombinerSingle.instance2Combined_MapGet (UnityEngine.GameObject gameObjectID) [0x00001] in D:\Unity\Sandbox2018\Assets\MeshBaker\scripts\core\MB3_MeshCombinerSimple.cs:114
    6.   at DigitalOpus.MB.Core.MB3_MeshCombinerSingle.Apply (System.Boolean triangles, System.Boolean vertices, System.Boolean normals, System.Boolean tangents, System.Boolean uvs, System.Boolean uv2, System.Boolean uv3, System.Boolean uv4, System.Boolean colors, System.Boolean bones, System.Boolean blendShapesFlag, DigitalOpus.MB.Core.MB3_MeshCombiner+GenerateUV2Delegate uv2GenerationMethod) [0x0085b] in D:\Unity\Sandbox2018\Assets\MeshBaker\scripts\core\MB3_MeshCombinerSimple.cs:1481
    7.   at DigitalOpus.MB.Core.MB3_MeshCombinerSingle.Apply (DigitalOpus.MB.Core.MB3_MeshCombiner+GenerateUV2Delegate uv2GenerationMethod) [0x00017] in D:\Unity\Sandbox2018\Assets\MeshBaker\scripts\core\MB3_MeshCombinerSimple.cs:1231
    8.   at DigitalOpus.MB.Core.MB3_MultiMeshCombiner.Apply (DigitalOpus.MB.Core.MB3_MeshCombiner+GenerateUV2Delegate uv2GenerationMethod) [0x0001c] in D:\Unity\Sandbox2018\Assets\MeshBaker\scripts\core\MB3_MultiMeshCombiner.cs:217
    9.   at MB3_MeshBakerCommon.Apply (DigitalOpus.MB.Core.MB3_MeshCombiner+GenerateUV2Delegate uv2GenerationMethod) [0x0001d] in D:\Unity\Sandbox2018\Assets\MeshBaker\scripts\MB3_MeshBakerCommon.cs:232
    10.   at MB3_MeshBakerEditorFunctions.BakeIntoCombined (MB3_MeshBakerCommon mom, System.Boolean& createdDummyTextureBakeResults) [0x00219] in D:\Unity\Sandbox2018\Assets\MeshBaker\Editor\core\MB3_MeshBakerEditorFunctions.cs:78
    11.   at DigitalOpus.MB.Core.MB3_MeshBakerEditorInternal.bake (MB3_MeshBakerCommon mom) [0x00029] in D:\Unity\Sandbox2018\Assets\MeshBaker\Editor\MB3_MeshBakerEditorInternal.cs:405
    12. UnityEngine.Debug:LogError(Object)
    13. DigitalOpus.MB.Core.MB3_MeshBakerEditorInternal:bake(MB3_MeshBakerCommon) (at Assets/MeshBaker/Editor/MB3_MeshBakerEditorInternal.cs:424)
    14. DigitalOpus.MB.Core.MB3_MeshBakerEditorInternal:DrawGUI(SerializedObject, MB3_MeshBakerCommon, Type) (at Assets/MeshBaker/Editor/MB3_MeshBakerEditorInternal.cs:371)
    15. DigitalOpus.MB.Core.MB3_MeshBakerEditorInternal:OnInspectorGUI(SerializedObject, MB3_MeshBakerCommon, Type) (at Assets/MeshBaker/Editor/MB3_MeshBakerEditorInternal.cs:145)
    16. MB3_MultiMeshBakerEditor:OnInspectorGUI() (at Assets/MeshBaker/Editor/MB3_MultiMeshBakerEditor.cs:58)
    17. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    I can also confirm that all three mesh elements to be combined; body, tongue and teeth, have the correct blend shapes available.
     
    Last edited: Jun 6, 2019
  42. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    I have tested Mesh Baker with 2019.1 and it does work.
    I have not tested it with LWRP specifically but it should work as long as the LWRP uses ordinary Material assets that use Textures.
     
  43. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Will take a look later today.
     
  44. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    UPDATE: There is a problem with a change I made to how source objects are referenced in MB 3.26. Still looking into the best solution.
     
  45. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    At this time I have a partial solution. I can use the blend shapes without errors on the combined mesh, but I am not able to create a prefab from the combined skinned meshed renderer. Still working on that issue. If you don't need the prefab part, let me know via PM or Email and I can send you what I have so far.

    [Update] I have a better fix now that correctly handles saving combined blend shapes in a prefab that can be used in another scene. It needs a bit of polish and I have to look into backward compatibility but hope to release the fix soon. Probably next week.

    [Update] I have released a new version of Mesh Baker that should fix this issue. It also changes how the BlendShapeSource2Combined map is handled. The old approach (querying for the map after a bake) did not work well when baking into prefabs and required the Mesh Baker to retain some data about the bake. The new approach is to serialize the map into a component that is added to the combined mesh. This data then gets automatically serialized when baking into prefabs.
     
    Last edited: Jun 19, 2019
  46. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    542
    A very newbie question: does Mesh Baker support baking a mesh with multiple materials into a single material?

    The model is a single mesh with a single uv set, but uv islands are grouped and overlapping, each uv island group correspond to a different material/textures. I did that for convenience and to maintain texel density, and now I want to combine these textures into an altas, offset uv islands according to materials, then use a single material instead.

    No sure Mesh Baker is designed to tackle this or not.

    (I bought this asset 2 years ago and this is my first time trying it.)

    (and oh I guess by definition, having multiple materials on a single mesh = have multiple submeshes.)
     
    Last edited: Jun 13, 2019
  47. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Yes, with the default setup all materials are collapsed into a single material and all submeshes are combined into a single submesh. If you want to customize that then you can enable the "multiple materials" option and configure a mapping which maps controls which source materials map to which target materials.
     
    bitinn likes this.
  48. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    109
    Hi,

    I have a feature request :
    It would be nice if could have the transform rotation of the combined mesh to be the average rotation of all meshes combined.

    In my case, I made a shader with shader graph where I use the Y object orientation to drive informations to meshes displayed horizontaly, verticaly and upside down. But it doesn't work since all combined meshes have the same transform orientation.

    And you're right. The agglomerative cluster type is awsome.
     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    Thanks for the suggestion. I will see what I can do regarding the rotation. You could workaround by manually rotating to where you want, pre-bake, but I get that it is a pain to do that.
     
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,540
    I have released a new version of Mesh Baker which should fix this issue. It can take a few days for Unity to review it.