Search Unity

  1. Unity 2019.2 is now released.
    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,577
    No this is not a problem. How the monsters are controlled (AI, Navmesh, Physics, Scripts) won't matter. All that matters are the bones. The bones of the source meshes will be shared with the combined meshes. There is a good example scene that combines some skinned mesh renderers and has buttons for adding and removing objects at runtime 'SkinnedMeshRenderer'. This video talks about special issues specific to SkinnedMeshRenderers.


    If your profiling indicates that the skinning and animation are expensive and monsters are often in the distance then LOD might be a good idea. If you have large mobs of monsters you might want to consider Mesh Baker LOD. One of its best features is to bake a crowd into a set of skinned meshes organized so that the close characters are high LOD and background characters are low LOD.
    Yes, what you describe is pretty much exactly the workflow you need. Again I would suggest, look a some of the example scripts. SceneDynamicAddingDeleting does something very similar to what you want.
     
    malkere likes this.
  2. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    Is your custom LOD Switcher script recommended (as step a.) due to increased performance over the default Unity LOD Group?

    Also, just as a suggestion, the reposition camera to match LOD distance is handy, and it does save the cameras position when turned on which is nice, but if you delete the object while it's still active you lose the position. If you could make it check to see if it should go back on destroy that could be even nicer.
     
    Last edited: Mar 30, 2018
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    If you have a few characters running around that are occasionally together, then I would recommend the regular LOD component. If you have a cluster of characters each with their own drawcall then I would suggest the custom LOD component.
     
    malkere likes this.
  4. tareksalah

    tareksalah

    Joined:
    Jan 28, 2017
    Posts:
    16
    Hi Ian,

    I've just downloaded the asset .. Took a while to figure out how to use it. Then I tried it on my models, and MeshBaker managed to successfully generate atlasses and combine meshes, however, with some missing textures and wrong placement of materials ... I need your support to know how to fix this? .. In the images below the model, you'll find the correct materials on the original model and wrong ones generated after mesh baking using red arrows ... I've added also the console messages and some of the warnings.


    I used MultiBeshBaker and clicked "Consider Mesh UVs" as it didn't work well without this option. I listed the shaders in the scene and generated meshbaler for the two groups (one with out of bound UVs and one for others) and baked into prefabs, which worked well.

    Please I need your support to correctly have the atlasses generated and assigned to models as I have more than 20 other models of the same complexity to work on.

    If you want to try yourself working on the model, please download it from here
    I've just reduced its mesh complexity on 3dmax before importing into Unity by 50% on average.


    ConsoleHubbleMeshBaker.PNG
    hubbleMeshBakerMismatch1.png hubbleMeshBakerMismatch2.png
     
  5. tareksalah

    tareksalah

    Joined:
    Jan 28, 2017
    Posts:
    16
    The warnings one Warnings.PNG
     
  6. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Hi tareksalah,

    Looking at the warnings it looks like some of the meshes do not have uvs, and some of them do have uvs. I suspect that the ones with no UVs are possibly using a shader with no textures or do not have textures assigned? Is this the case?The ones with no UVs are going to be problematic to combine.

    I would suggest:

    1) Look at how the materials work for the meshes with no UVs. If these materials have no textures and just use a color, then the meshes can only be combined if their materials use the same color or the meshes use the same material. Some options to make this work are:
    a) Give the meshes with no UVs a UV channel in max before import & then use a small texture go give each mesh its color.
    b) Use a different shader that uses textures if the current shader doesn't use textures.
    c) Possibly modify the shader so that it grabs its color from a texture instead of a property if there is no property.

    2) If the materials on different parts are too different then you may need use more than one baker or you may need to use the Multiple Materials feature to map the source meshes to different submeshes (combined materials with different shaders) based on the materials they use. You can use the 'Window -> Mesh Baker -> Search For Meshes To Add' to collect objects using a particluar shader or material for a particular baker.

    I will download the model and see if that provides any more insight.
     
  7. tareksalah

    tareksalah

    Joined:
    Jan 28, 2017
    Posts:
    16

    Ok I'll try these recommendations, however, Mesh Baker actually did it right in early trials and correctly placed materials to these parts except for the writing of NASA on the silver plate, which was never originally grouped in the corresponding Texture Atlass. So maybe this part has no UVs. But other materials were correctly placed before.
     
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I have downloaded the model and started playing around with it. I will let you know what I find.

    Good results using:

    1) A multi mesh baker
    2) Baked textures using:
    resize power of two
    consider mesh UVs
    Force power of two atlas
    Blend non texture properties​
    3) I tried baking meshes but the meshes exceed 64k and generated errors. This can happen when UV channels are generated. Reduced the max vertices allowed in combined meshes to 55k and rebaked.
     
    Last edited: Apr 3, 2018
  9. gdp2

    gdp2

    Joined:
    Dec 6, 2016
    Posts:
    25
    Anyone else seeing errors in the Unity 2018.1 beta? E.g.

    `UnityEngine.ProceduralMaterial' is obsolete: `Built-in support for Substance Designer materials has been removed from Unity. To continue using Substance Designer materials, you will need to install Allegorithmic's external importer from the Asset Store.'​

    Not really sure what to do...
     
  10. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I will try to remove all references to procedural materials in the next release. In the meantime this code should be easy to remove. Make the following changes:

    In MB3_TextureCombiner.cs. Remove the contents of "addProceduralMaterial" and "restoreProceduralMaterial":

    Code (CSharp):
    1.  
    2.         public void _addProceduralMaterial(ProceduralMaterial pm)
    3.         {
    4.             /*
    5.             ProceduralMaterialInfo pmi = new ProceduralMaterialInfo();
    6.             pm.isReadable = pm.isReadable;
    7.             pmi.proceduralMat = pm;
    8.             _proceduralMaterials.Add(pmi);
    9.             */
    10.         }
    11.        
    12.  
    13.         public void _restoreProceduralMaterials()
    14.         {
    15.             /*
    16.             for (int i = 0; i < _proceduralMaterials.Count; i++)
    17.             {
    18.                 ProceduralMaterialInfo pmi = _proceduralMaterials[i];
    19.                 pmi.proceduralMat.isReadable = pmi.originalIsReadableVal;
    20.                 pmi.proceduralMat.RebuildTexturesImmediately();
    21.             }
    22.             _proceduralMaterials.Clear();
    23.             */
    24.         }
    In TextureCombinerAtlasRect.cs remove the reference to ProceduralMaterial

    Code (CSharp):
    1.     class ProceduralMaterialInfo
    2.     {
    3.         //public ProceduralMaterial proceduralMat;
    4.         public bool originalIsReadableVal;
    5.     }
    In MB3_TextureCombinerPipeline.cs remove the references to ProceduralMaterial
    Code (CSharp):
    1.  
    2.                     //if (mat is ProceduralMaterial)
    3.                     //{
    4.                     //    combiner._addProceduralMaterial((ProceduralMaterial)mat);
    5.                     //}
    Code (CSharp):
    1.                 /*
    2.                 for (int i = 0; i < combiner._proceduralMaterials.Count; i++)
    3.                 {
    4.                     if (!combiner._proceduralMaterials[i].proceduralMat.isReadable)
    5.                     {
    6.                         combiner._proceduralMaterials[i].originalIsReadableVal = combiner._proceduralMaterials[i].proceduralMat.isReadable;
    7.                         combiner._proceduralMaterials[i].proceduralMat.isReadable = true;
    8.                         //textureEditorMethods.AddProceduralMaterialFormat(_proceduralMaterials[i].proceduralMat);
    9.                         combiner._proceduralMaterials[i].proceduralMat.RebuildTexturesImmediately();
    10.                     }
    11.                 }
    12.                 */
     
  11. Denis-Shevchenko

    Denis-Shevchenko

    Joined:
    Jul 17, 2016
    Posts:
    17
    Hi Phong,

    We are using MeshBaker in our game to combine characters from various pieces on the fly. That works smoothly on desktops and on most Android devices, however on Samsung phones the resulting mesh gets distorted in a pretty bizzare way:

    IMG_07042018_001650_0.png

    While normally it should be like this:

    Screen Shot 2018-04-07 at 11.57.20.png

    Frankly I have no idea where to dig. All character parts are low poly and verts are way below 10k, if it matters. Do you have any thoughts what can cause such behaviour and how it can be fixed?

    Thank you!
     
  12. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    It doesn't look like a mesh issue to me. it looks like a rendering problem. i would try a few experiments.

    try a non mesh baked mesh to see if it has the same behavior.
    try a material with a different shader.
    look at the camera you are using for this.is there anything odd? try pushing the near clip plane out a bit if it is very small number. this could be a z buffer resolution problem.

    CONTINUED Sorry for the interumption, had to jump on a plane.

    other things i would check are post processing effects. Try turning these off and on.
    Also look at player setting. Some of these that affect rendering could be doing something.
    One other thing to consider. Is the mesh scaled a large amount? This could be floating point rounding.
    Another possibility. Skinning on the gpu, are you using that option. I have found it to be flaky on some mobile devices.
     
    Last edited: Apr 8, 2018
  13. tareksalah

    tareksalah

    Joined:
    Jan 28, 2017
    Posts:
    16
    Please I'm working on another model now which has 16 materials and just one mesh. I understand that if I bake the materials into just 1, I'll need to bake the mesh .. Right?

    (All the 16 materials use the same shader: Standard Roughness. Some with textures and some with only a color)

    The image below shows the baked one to the right ... Now the materials had out of bound UVs, and I had to place each manually in the mesh baker that was automatically generated after using "Select Shaders in Scene"

    But I don't know why it doesn't get it right?

    By the way, I don't know much 3D modeling and I'm using mesh baker to do the task for me, so I thought the process would be straightforward in using this asset!


    SkyLab.PNG

    Texture Baking Warnings:

    Skylab Warnings.PNG


    Mesh Baking Warnings:

    Baking Warnings.PNG
     
    Last edited: Apr 7, 2018
  14. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    it looks like you are using out of bounds uvs without using the consider uvs options. This video explains what is going on.
    .
     
  15. nrj1

    nrj1

    Joined:
    Aug 15, 2014
    Posts:
    6
    Hi Ian,

    I've been playing with MeshBaker the past few days and I must say it's a real time saver.

    However, I got stuck when I created a TextureBaker with Multiple Combined Materials. It looks like Unity is not creating correct baked lightmaps for these meshes. The lightmaps are created correctly for meshes that are not made with MeshBaker.

    To illustrate this behaviour, I made a small video. Hope this helps:



    Am I doing something wrong? Any help would be appreciated.

    Thanks for your time!
     
  16. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    Are you adding this back?? Substance is making there own plug in since Unity is always behide Substance new updates versions... So it should be out soon.
     
  17. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Hi nrj1, thanks for posting this. I won't be able to take a close look at this until next week since I am on vacation in Mexico ATM with only a surface tablet and very slow internet connection. I tried to watch the video but the quality is too low over this connection to see what is going on. It is possible that the UV2 channel is not being generated correctly when using the Multiple Materials. I will check to code and create a test to see if that is the case.
     
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I intend to look at this when the Substance plugin comes out. It will be a bit tricky because Mesh Baker needs to work with and without the Substance plugin being present and it will depend on the API that is available in the plugin. If I can't convert substance materials to textures through the API then it won't be possible to integrate.
     
  19. nrj1

    nrj1

    Joined:
    Aug 15, 2014
    Posts:
    6
    Thanks, I really appreciate it.

    Hope you are having a nice vacation.
     
  20. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    ya hope that is not the case, as it will cripple some companies, people.. and force us out of either redoing texuring of our entire games, releasing ..or ditching mesh Baker.... I know its kinda out of your control . but I hope its not the ladder.. Thanks for the fast reply. I been using Mesh Baker for years hate to have to ditch it.
     
  21. devstudents

    devstudents

    Joined:
    Feb 18, 2014
    Posts:
    132
    Hello. I'm getting the following errors when I install Mesh Baker pro:

    1) Assets/MeshBaker/scripts/Editor/MB3_MBVersionConcreteEditor.cs(34,65): error CS0619: `UnityEditor.BuildTarget.WebPlayer' is obsolete: `WebPlayer has been removed in 5.4'

    2) Assets/MeshBaker/scripts/Editor/MB3_MBVersionConcreteEditor.cs(35,65): error CS0619: `UnityEditor.BuildTarget.WebPlayerStreamed' is obsolete: `WebPlayerStreamed has been removed in 5.4'

    How do I correct this without breaking anything?
     
  22. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Which version of Unity are you using? It looks like the block:

    Code (CSharp):
    1. #if !UNITY_5_4_OR_NEWER
    2.             if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebPlayer ||
    3.                 EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebPlayerStreamed
    4.                 )
    5.             {
    6.                 return "Web";
    7.             }
    8. #endif
    Is not working. I would suggest removing everything between the #if .... and #endif lines

    I am curious which version of unity you are using? If it is pre 5.4 then the WebPlayer and WebPlayerStreamed should be there. If not then that code should be invisible to the compiler.
     
  23. nrj1

    nrj1

    Joined:
    Aug 15, 2014
    Posts:
    6
    Hi Ian,

    Have you had a chance to take a closer look at the video I posted last week?

    I would love to use Mesh Baker in my project but I am stuck because I need to also use baked lightmaps at the same time.

    Let me know what you think.
     
  24. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Sorry for dropping the ball and not getting back to you. I added it to my TODO list but that never go synced to my workstation when I got back.

    Just watched your video. I think the problem is the lightmapping UVs. In the Mesh Baker Inspector there is a dropdown. Lightmap UVs. If you want to lightmap a combined mesh then you need to use either:

    • Map UV2 to separate Rects
    • Generate new UV2 layout
    Otherwise multiple instances of the same mesh (that get combined) have UV2 that overlap and you get messed up Lightmapping when you bake.
     
  25. nrj1

    nrj1

    Joined:
    Aug 15, 2014
    Posts:
    6
    Tried both options:

    "Generate new UV2 layout" threw some errors that there were more than 64k vertices.
    "Map UV2 to separate Rects" had some warnings that there was no UV2 to be copied.

    They both seemed to work however and solve the problem I was having.

    I chose to go with the "Map UV2 to separate Rects" in the end since it had no errors.

    Thanks so much for your help! I really appreciate it.
     
  26. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    42
    Batch Prefab Baker not baking correctly

    Hi, I´m asking for some help here, after spent the last eight hours trying to figure out what´s wrong

    One of the prefabs is not baking (the selected one in the image) for some unknown reason

    I even reimported it and everythinghumanly possible for no avail

    if you have any idea of what could possibly be wrong

    prefab problem.png prefab problem.png prefab problem b.png prefab problem c.png
     
  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Are there any warnings or errors or other messages in the console? Also have the materials used by that prefab been baked into the Texture Bake Result used by the TextureBaker attached the Batch Prefab Baker game object?
     
  28. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    42
    Hi

    Thanks for the reply

    This one:

    Assertion failed: GetObject failed to find Object for Library Representation: name 'Lancer_2' path '' guid e75ed6ff25dfe844f9c4fa03df134586

    It HAS something to do with the model import settings because some of the other objects also did not bake correctly at first, but then I changed some of their settings and they worked

    except for this one you are seeing...


    really weird
     
  29. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    42
    Just tried again, I think this is relevant:

    Mesh on Player Lancer Weapon(Clone) (UnityEngine.MeshRenderer) uses a material Lancer_diffuse 256 (UnityEngine.Material) that is not in the list of materials. This mesh will not be baked. The original mesh and material will be used in the result prefab.
    UnityEngine.Debug:LogWarning(Object)
    MB3_BatchPrefabBakerEditor:IsGoodToBake(Renderer, MB2_TextureBakeResults) (at Assets/_Assets/MeshBaker/scripts/Editor/MB3_BatchPrefabBakerEditor.cs:378)
    MB3_BatchPrefabBakerEditor:_bakePrefabs() (at Assets/_Assets/MeshBaker/scripts/Editor/MB3_BatchPrefabBakerEditor.cs:216)
    MB3_BatchPrefabBakerEditor:OnInspectorGUI() (at Assets/_Assets/MeshBaker/scripts/Editor/MB3_BatchPrefabBakerEditor.cs:108)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  30. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I think that is your issue. Make sure that that there is an instance of Player Lancer Weapon in the list of objects on the TextureBaker. Then rebake the textures and rebake the prefabs.
     
  31. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    42
    Thanks for your help

    The answer was much simpler than that, the material in the original object was different than the instance at the scene so, instead of baking a prefab with new UVs Mesh Baker bypassed it and kept the original one...

    solved now!
     
  32. bobofighter

    bobofighter

    Joined:
    Apr 26, 2018
    Posts:
    1
    Hi @Phong ,
    I bought Mesh Baker ver. 3.24.3 and I am using Unity 2017.1.0f3.

    I got this error


    TextureFormat is invalid!
    UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
    DigitalOpus.MB.Core.MB3_EditorMethods:SetTextureFormat(Texture2D, TextureFormatInfo, Boolean, Boolean) (at Assets/Extensions/MeshBaker/scripts/Editor/core/MB3_TextureCombinerEditorFunctions.cs:240)
    DigitalOpus.MB.Core.MB3_EditorMethods:AddTextureFormat(Texture2D, Boolean) (at Assets/Extensions/MeshBaker/scripts/Editor/core/MB3_TextureCombinerEditorFunctions.cs:179)
    DigitalOpus.MB.Core.<__Step2_CalculateIdealSizesForTexturesInAtlasAndPadding>c__Iterator4:MoveNext() (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:1105)
    DigitalOpus.MB.Core.MB3_TextureCombiner:RunCorutineWithoutPause(IEnumerator, Int32) (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:492)
    DigitalOpus.MB.Core.MB3_TextureCombiner:RunCorutineWithoutPause(IEnumerator, Int32) (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:505)
    DigitalOpus.MB.Core.MB3_TextureCombiner:RunCorutineWithoutPause(IEnumerator, Int32) (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:505)
    DigitalOpus.MB.Core.MB3_TextureCombiner:RunCorutineWithoutPause(IEnumerator, Int32) (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:505)
    DigitalOpus.MB.Core.MB3_TextureCombiner:RunCorutineWithoutPause(IEnumerator, Int32) (at Assets/Extensions/MeshBaker/scripts/core/MB3_TextureCombiner.cs:505)
    MB3_TextureBaker:CreateAtlases(ProgressUpdateDelegate, Boolean, MB2_EditorMethodsInterface) (at Assets/Extensions/MeshBaker/scripts/MB3_TextureBaker.cs:352)
    DigitalOpus.MB.Core.MB3_TextureBakerEditorInternal;DrawGUI(SerializedObject, MB3_TextureBaker, Type) (at Assets/Extensions/MeshBaker/scripts/Editor/MB3_TextureBakerEditorInternal.cs:320)
    MB3_TextureBakerEditor:OnInspectorGUI() (at Assets/Extensions/MeshBaker/scripts/Editor/MB3_TextureBakerEditor.cs:33)
    UnityEngine.GUIUtility;ProcessEvent(Int32, IntPtr)

    any Ideas what's going on? my source images are formatted as .tif
     
    Last edited: Apr 26, 2018
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Hmmm, my line numbers don't line up with yours. It looks like the Mesh Baker is trying to set the crunch compression or possibly normal map for that texture, but Unity is saying that the crunch compression is invalid. Is there a line in the log immediately after that message that says what compression format it is trying to set the texture to?

    Also what build platform are you building for?
     
  34. TechTools

    TechTools

    Joined:
    Nov 21, 2013
    Posts:
    19
    Hi, thanks for this asset. I've purchased it already and enjoying looking through the API and example scenes. I think I'm misunderstanding how skinned mesh renderers work though. In the example you have several skinned mesh renderers combined in one and they still animate, but I don't see how to change their animations at runtime. My project consists of multiple characters each of which uses mecanim. If possible can you let me know how to achieve this?
     
  35. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Yes, the combined mesh shares the same bones as the source meshes. You can disable the SkinnedMeshRenderer on the source meshes but leave everything else on them enabled (scripts, animations, etc...). The animator moving the source bones will move the combined mesh. Note that to make this work you will need to switch the culling settings on the source animator to "always animate" or it may think the animation is invisible because its renderer is disabled.
     
  36. TechTools

    TechTools

    Joined:
    Nov 21, 2013
    Posts:
    19
    Thanks for the reply. I will give this a try over the next day or two and let you know if I get it working. I read the forum posts and it seems that support for this has changed since the original release. For example it mentions there may be an issue regarding legacy vs humanoid animations. Also what about about blend trees? I'd understand if there are limitations, I'd just like to be aware of them so that I can work around them. Also if there are any examples of using Mecanim with Mesh Baker, I'd really appreciate the reference.
     
    Last edited: Apr 30, 2018
  37. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    There are a few examples of animated meshes with the example scenes. The main limitations are:

    1) Doesn't work with 'Optimized' rigs. Where all the bones are hidden.
    2) Animation culling based on renderer doesn't work.
    3) You need to manage the render bounds of the combined skinned mesh yourself. There are a couple of scripts that can help with this.
    4) BlendShapes can be baked into the combined mesh but the index numbers will change if there is more than one source mesh with blend shapes. This means that that animate the blend shape weights won't work. You can control the blend shapes with scripts but will need use the new blend shape indexes.

    There should be no problem using Mecanim animations.
     
  38. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    16
    Hi, I'm having issues. After trying several options (including padding inclussion), I was not able to get the correct lightmapping.
    Material : Substance designer procedural materia. (left).
    After baking lights, I'm getting strange spots.
    Any hint?

    Best regards!

    2018-04-29_23-51-46.jpg
     
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I presume you are exporting the substances as bitmaps then baking them into an atlas with Mesh Baker?
    When baking the combined mesh make sure you are using one of:
    • Lightmap UVs
      • Copy UV2 to separate rects
      • Generate new UV2 layout
    If you do this and still get spots, make sure you have decent lightmap resolution and padding in the lightmap. If you select the mesh and look at your lightmap you might be able to see the UV2 overlayed (not sure if this feature still exists). If you zoom in you can sometimes see that a single texel can span the gap between two UV islands. If this happens then you can get spots.
     
  40. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
     
  41. TechTools

    TechTools

    Joined:
    Nov 21, 2013
    Posts:
    19
    Hi and thanks again for your reply yesterday. I have tried this out with my own skinned mesh renderer based models, and I'm glad to say that everything works as I'd expected. This optimization will make a very significant difference to our game I have no doubt. I may have another question after trying a few things, but again first impressions are very favourable.
     
  42. northman

    northman

    Joined:
    Feb 28, 2008
    Posts:
    125
    Hello, MeshBaker is really good combine tool for Unity, but today when I upgrade to Unity2018.1, the MeshBaker has those err-messages:
    MeshBaker_Problem.png
    If possible please upgrade MeshBaker to Unity2018.
    Thanks,;)

    S.Z.
     
  43. KovaPx

    KovaPx

    Joined:
    Jan 27, 2018
    Posts:
    13
    Hey I had problems with max texture size not calculating correctly on platforms other then default. The value is set only on default platform, so I've fixed MB3_EditorMethods.SetTextureSize(Texture2D, int)
    The problem was we had texture pre processing that overrides texture format on platforms, so applying maxTextureSize only to default doesn't carry over to that platform later in the process.

    Code (CSharp):
    1.         public void SetTextureSize(Texture2D tx, int size)
    2.         {
    3.             TextureImporter ai = AssetImporter.GetAtPath(AssetDatabase.GetAssetOrScenePath(tx)) as TextureImporter;
    4.             if (ai == null) return;
    5.  
    6.             int maxSize = 32;
    7.             if (size > 32) maxSize = 64;
    8.             if (size > 64) maxSize = 128;
    9.             if (size > 128) maxSize = 256;
    10.             if (size > 256) maxSize = 512;
    11.             if (size > 512) maxSize = 1024;
    12.             if (size > 1024) maxSize = 2048;
    13.             if (size > 2048) maxSize = 4096;
    14.  
    15.             bool isSettingsChanged = false;
    16.             if (ai.maxTextureSize != maxSize)
    17.             {
    18.                 ai.maxTextureSize = maxSize;
    19.                 isSettingsChanged = true;
    20.             }
    21.             string[] platforms = { "Standalone", "Web", "iPhone", "Android", "WebGL", "Windows Store Apps", "PSP2", "PS4", "XboxOne", "Nintendo 3DS", "tvOS" };
    22.             foreach (var platform in platforms)
    23.             {
    24.                 var settings = ai.GetPlatformTextureSettings(platform);
    25.                 if (settings != null && settings.overridden && settings.maxTextureSize != maxSize)
    26.                 {
    27.                     settings.maxTextureSize = maxSize;
    28.                     ai.SetPlatformTextureSettings(settings);
    29.                     isSettingsChanged = true;
    30.                 }
    31.             }
    32.  
    33.             // reimport if anything changed
    34.             if (isSettingsChanged)
    35.             {
    36.                 ai.SaveAndReimport();
    37.             }
    38.         }
     
  44. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I will try to push out a fix for this today. Unfortunately it takes a few days to update in the store.
     
  45. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Thanks, I will add this fix.
     
  46. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I just tested the latest version in 2018 and it compiles in 2018. Check your version if you are not on 3.25.0, try updating.

    It will probably be a week or so before I update the Free Version.
     
  47. Bluestek

    Bluestek

    Joined:
    Jan 11, 2013
    Posts:
    8
    When I bake submeshes the bake doesn't match the original and was wondering if you know what may be causing the shift.



    Each submesh uses a single color texture.
     

    Attached Files:

  48. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,036
    @Phong ,

    Hi, looking at this Asset. Does it work in game at runtime?

    I have some excellent Fuse models courtesy of Arteria3D cloth skinned meshes. So a body skinned mesh with Mixamo:hip and then same with various items of clothing as skinned meshes on same mixamorig:hip.

    I'd like to apply layers (for example, body, then hair then hat etc) skinned meshes to same character in runtime and without 'inner layer' skinned mesh(es) poking through (for example, hair through hat etc).

    Can this Asset help with this sort of character 'assembly' at runtime?
     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    I would carefully compare the before and after materials. First check they are using the same shader. Then check the non-texture properties. Check that these are similar or the same on the combined material.

    You could try the consider non-texture properties. It works fairly well if you are using the Standard shaders. If you are using a custom shader then you may need to write a TextureBlender extension to get it to work properly with your shader.

    Check that when baking you are generating the same channels that exist on the source meshes. If you are using vertex colors then the Vertex Colors channel will need to be checked.

    You could try duplicating your source materials, switching the textures to the baked textures and using these on the combined mesh.
     
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,577
    Yes, this asset has a character customization system that is designed to be used at runtime (although there are some preprocessing steps that need to be completed in the editor).

    Mesh Baker will not remove the inner meshes. You will need to do that yourself. My strategy is to break up the source meshes into may versions of each body part. All bound to the same rig.
    • HandNoGlove, HandLeatherGlove,HandGauntlet
    • ArmBare, ArmWithLongSleeve, ArmWithShortsleeve, ArmWithArmour
    • etc...
    These skinned body parts need to line up (vertex to vertex) at the seams. MeshBaker includes a script that will post process these meshes in the editor so that the properties for each seam vertex matches exactly (Same bone weight, normal). Once this has been done then Body Parts can be mixed and matched at runtime.

    Here is a youtube video that shows the process:

     
    Duffer123 likes this.