Search Unity

Mesh Baker by Digital Opus [RELEASED]

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

  1. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Hello Ian,

    I’m currently setting up Mesh Baker in my game using the free version to ensure that it will help with performance in this use case. After this I intend on purchasing the full asset so I can apply my own shaders.

    I am attempting to bake multiple SkinnedMeshRenderers together, and have been successful using the editor, but not so much when trying to code this at run-time.

    I am experiencing exactly the same error Novack reported in post #1384 of this thread.

    I setup the Baker via script. Now, if I go into the inspector and press the ‘Bake' button manually at this stage every works correctly and as intended (the combined skinned mesh is produced), but if I instead simply run meshBaker.Apply() (which I assume runs the same functionality as pressing Bake?) from script I receive the same error Novack produced,

    'Target Renderer was not set.
    UnityEngine.Debug:LogError(Object)
    DigitalOpus.MB.Core.MB3_MeshCombinerSingle:ValidateTargRendererAndMeshAndResultSceneObj()
    DigitalOpus.MB.Core.MB3_MeshCombinerSingle:Apply(Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, GenerateUV2Delegate)
    DigitalOpus.MB.Core.MB3_MeshCombinerSingle:Apply(GenerateUV2Delegate)
    MB3_MeshBakerCommon:Apply(GenerateUV2Delegate) (at Assets/MeshBaker/scripts/MB3_MeshBakerCommon.cs:170)
    MeshBakerTest:Bake() (at Assets/Scenes/MeshBakerTest.cs:39)
    MeshBakerTest:Update() (at Assets/Scenes/MeshBakerTest.cs:26)
    '

    Is Apply() the correct method to use? - I cannot understand why this would work within the editor but not via script.

    Picture of MeshBaker in editor, before pressing 'Bake' or running Apply():


    I also have some further questions of how to run and alter Baker variables at run time via script - I’ve read through your documentation and watched the videos but am unsure of the correct scripting calls to make. Could you write a line example for each?:

    1. Via script how can I set the 'Combined Mesh Object' in the mesh baker script - I cannot find an example?
    2. How can I change the renderer type from 'Skinned Mesh Renderer' to 'Mesh Renderer'? A suggestion is meshBaker.renderer, but it appears this has been depreciated.
    3. How can I disable the renderers on the Source Objects after using Apply()? - is it 'meshBaker.EnableDisableSourceObjectRenderers(true);'? - does this have to be done before running Apply()?

    Thanks in advance.
     
    Last edited: Nov 18, 2017
  2. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Update:

    So with a little further research I found post #1589 in which you suggest to use 'AddDeleteGameObjects', which I suspect may be the cause of the problem I am encountering in my previous post. This is what I will try next.

    Before I can attempt that solution I am now encountering a different issue for reasons I cannot understand. The following errors are now being displayed:



    Even upon starting a fresh project and importing MeshBaker from the Asset Store fresh I receive the same errors.

    I'm sure this will be a simple fix - any help would be appreciated.
     
    Last edited: Nov 18, 2017
  3. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    168
    Hello.
    Any luck on what that warning message is please. :)

    I am still getting it.
     
  4. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    68
    Does Mesh Baker work with assets created in ProBuilder?
     
  5. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Hi Antony,

    This could be correct. One problem with mesh combining is that meshes that were being culled are now not which can boost the verts and tris. If the user can enter the house and walk through the rooms then I wouldn't recommend combining all the meshes. A good general approach is:
    • Create modified meshes which can share materials. Use these meshes wherever possible. Most of the benefit comes from this because it reduces setpass calls which are really expensive.
    • Bake meshes together that are close together. For example books on a bookcase. A pile of crates. There is also a benefit from this because Unity needs to work with fewer objects.
     
  6. Phong

    Phong

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

    Are you using the latest version? I thought I had fixed the 'Target Renderer Not Set' issue.

    Regarding your other questions about the API. The MeshBaker component is largely a wrapper for a MB3_MeshCombiner class instance. Once you get the MeshCombiner you can do everything on that. The API was designed this way so that baking can be done without needing components on game objects in the scene. If you are doing everything from a script can work directly with the mesh combiner class and not bother with the MeshBaker component at all:

    1. Via script how can I set the 'Combined Mesh Object' in the mesh baker script - I cannot find an example?

    Code (CSharp):
    1. MB3_MeshBaker myMeshBaker;
    2. myMeshBaker.meshCombiner.resultSceneObject = myScenGameObject
    2. How can I change the renderer type from 'Skinned Mesh Renderer' to 'Mesh Renderer'? A suggestion is meshBaker.renderer, but it appears this has been depreciated.

    Code (CSharp):
    1. MB3_MeshBaker myMeshBaker;
    2.             myMeshBaker.meshCombiner.renderType = MB_RenderType.skinnedMeshRenderer;

    3. How can I disable the renderers on the Source Objects after using Apply()? - is it 'meshBaker.EnableDisableSourceObjectRenderers(true);'? - does this have to be done before running Apply()?

    Yes this will disable the renderers. It does not matter when it happens, although if you disable the renderers in one frame and don't call Apply until the next frame then your objects will be invisible for a frame.
     
  7. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Yes, as long as ProBuilder creates Meshes and Textures that are renderered using MeshFilters and MeshRenderers then Mesh Baker can work with them.
     
    DarriasArt likes this.
  8. Phong

    Phong

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

    I just tried downloading it and it worked for me. You would get those errors if Unity cannot find the MeshBakerCore.dll and MeshBakerEvalVersionEditor.dll files. Could you check to see if these are in your project? Are you putting MeshBaker in a plugins folder? The plugins folder has special status in Unity and is compiled in an earlier pass. That could possibly be messing things up.

    Which version of unity and which platform are you using?
     
  9. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Hi Dayn1,

    Sorry for the slow response, I have been swamped the past few days.

    Can you describe what you are trying to do? I tested the 'Bake Every Mesh Baker In Scene' feature and found the following:
    • The feature works when the bakers consist of a TextureBaker with one or more MeshBakers as children. The TextureBakers must be configured with a Combined Material and Texture Bake Result asset.
    • The feature does not work if you are trying to combine MeshBakers without first combining the Textures.
    I will try to fix the feature so that it works works for MeshBakers without TextureBakers.
     
  10. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Thanks for the response Ian,

    After putting MeshBaker into the Plugins folder I receive a different error. The second and third are just warnings.



    The full error message is as follows:

    'This error occurs in '/Users/ ... /Assets/Plugins/MeshBaker/scripts/Editor/MB3_MeshBakerEditorInternal.cs(45,45): Error CS0012: The type `MB3_MeshBakerCommon' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Assembly-CSharp-Editor-firstpass)'

    I am currently using Unity 2017.1.1f1, using Monodevelop, and building for Android.
     
  11. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    203
    Is it possible to bake an atlas without combining everything into a single mesh?
     
  12. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    168

    Hello.

    And thank you for the reply. And no problem at all about the time, I can imagine you are very busy.

    I read your reply, and have to own, I am pretty new to Unity. I have managed to learn a loot over the past few months. But I didn't really understand what you meant.

    Do I have to combine the individual meshes / textures / materials before baking every mesh in the scene? And If this is correct, again I have to admit I do not understand why the later would be needed.

    I am honestly not trying to be a pain. My goal is to learn, so I can optimise more efficiently.

    I did go through each individual listed group last week, and tried to combine each separate list it generated.) But I couldn't see that it had registered.
    Each time I clicked "generate baker" on each list, nothing seemed to happen.
    And so because there are so many meshes / textures, in this particular scene I was trying to combine them en masse.
    Im not sure if this is possible.

    Also the folder I created in MeshBaker (the one I assigned when I clicked the "Select folder for combined material assets." Is empty.
    I have run Meshbaker many times, that time I went through each listing one by one, and the times I have "baked every mesh in scene." (But the cupboard is bare. ;) The assigned folder is empty.

    This is what I am doing. I list every shader in the scene. (There is a lot of entries
    I have the selection set up at default. .)
    Shader
    Static
    Render.
    etc.

    After it has listed them all.. again lots of entries

    I really appreciate any help you m
    I just click "Bake every MeshBaker in the scene."

    And the console goes wild. I did it just before typing this comment, and its still adding.
    entries.

    NullReferenceException: Object reference not set to an instance of an object
    MeshGen.OnDrawGizmos () (at Assets/EasyRoadsMeshGen/MeshGen.js:67)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    I have also tried different configurations of the tabs.. eg..
    Material
    Static
    Shader
    Lighting.
    (Basically just to have a different set of variables.)

    And then I clicked "Bake every MeshBaker in the scene." again.
    and once again endlessly recurring console errors, with the exact same text.

    I thank you for any help, or advice.
    But I do appreciate that I am using the free version. And if what I am trying to do is not possible, I understand. and appreciate the reply anyway. :)

    Best.

    Andy.
     
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Hi Andy,

    Have you viewed some of the tutorial videos? https://www.youtube.com/playlist?list=PLCzm-udM-shlRUy5f9QHHxqqv-9wP5FBM

    I would suggest getting familiar with basic usage of the TextureBaker and MeshBaker components before using the features in the MeshBaker window.

    Generally textures must be combined into atlases first, then meshes can be combined. Much of the performance benefit can be achieved by making objects share a material (using the atlas) even if meshes are not combined. Meshes need to be combined with care as it can be counterproductive if meshes that would never be visible at the same time are combined. Each texture baker in the scene must be configured (objects added, combined material assets created, bake options adjusted) before clicking the bake button. In your case it sounds like the texture bakers are not set up. My general workflow is usually:
    • Use the 'list shaders in scene' to find groups of objects that could potentially be combined.
    • Once I have good candidates, I try to build BatchPrefabBakers for those. This is often a trial-and-error process to find prefabs that fit well together in an atlas.
    • Replace the pefabs in the scene with the versions that share materials
    • Use the Mesh Baker Grouper features to find meshes that are close together and group them.
     
    JDrem1 likes this.
  14. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Yes, check out the Batch Prefab Baker:

     
  15. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    203
    Damn, but I need to make a source and a result prefab for every single object I want to atlas?
     
  16. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    You can use the mesh baker with output 'Bake Mesh Assets In Place' but it is a harder workflow as it is necessary to set the transforms of the source objects to 0,0,0, 0,0,0 1,1,1 in order to get good results and you need to switch the material an mesh yourself on the objects.

    Mesh Baker can create the result prefabs in an automated step, but you need to supply source prefabs.
     
  17. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    168

    Hello Phong.

    And thank you very much for the detailed response, and help.

    I will follow your instructions. Of both what you do, And I will watch more of the videos, and re-watch the ones I have already viewed. Now with more info, and insight.
    This was very helpful.

    I really appreciate it.

    Best Regards.

    Andy. :)
     
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    I would recommend not using the plugins folder. I tested in clean project in 2017 but still can't reproduce this problem. You could try deleting all the assemblies out of the Library/ScriptAssemblies folder. This will force Unity to rebuild everything. Can you also check your project folder to see that the MeshBakerCore.dll and MeshBakerEvalVersionEditor.dll are present?
     
  19. zukinet

    zukinet

    Joined:
    Oct 30, 2016
    Posts:
    44
    Hi,

    i have 25 UI buttons in a Canvas for MAIN MENU...
    in this button, i have sprite image for this button.
    All UI produce 29 draw call (setpass call),





    my question,

    How to BAKE all sprite of each button, to save draw call because this 29 draw call slower my game...
     
  20. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    203
    I think it's better to use Unity's sprite packer in this case.
     
  21. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Ian,

    MeshBakerCore.dll and MeshBakerEvalVersionEditor.dll were present, that was not the issue. I've got it running after moving MeshBaker into the Plugins folder, back out again, and rebooting Unity - not quite sure what the problem was, it did not work beforehand when directly imported outside of the Plugins folder. Anyway, it is now running perfectly.

    It now bakes at runtime as well - using AddDeleteGameObjects() resolved this issue.

    Thanks for all the help Ian - will keep working away at it.
     
  22. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    203
    So the best way would be to atlas around 50 objects would be to create prefabs, bake an atlas, and replace the old objects with the result prefabs?
     
  23. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    68
    If my game doesn't use textures in the materials, do I need to bake them?

    What happens if I try to bake meshes without baking textures/materials?
     
  24. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Ian, I have a question for you regarding TextureBaker, and whether it yields any benefit in terms of the process over doing the work manually.

    Lets say that I will have multiple, duplicates of an object within a scene. I will use the mesh baker to combine the duplicates of this object and reduce the draw calls down - this is definite.

    In regards to texturing on the object though:

    if I were to manually UV unwrap and texture this object with textures from a single image (a self-made combined mesh material, doing this instead of using textureBaker) - and then I MeshBake the duplicates of this object together would it perform any worse performance without the use of the textureBaker in the process? By creating my own combined material mesh am I simply just putting in the extra work and optimising the draw calls of materials manually myself?
     
  25. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    I would agree with NOOMKRAD, that the Unity Sprite packer is the way to go for Unity GUI UI elements.
     
  26. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    That is what I would do. The tricky part is replacing the old objects with the prefabs if there are a lot of objects in the scene. I am currently working on scripts for this but they are not ready for release yet.
     
  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    If your materials uses _color then you can turn on 'blend non-texture properties' and Mesh Baker will create tiny colored textures for each material to use in the atlas. If your materials have no color properties at all then you can't use atlases.

    If you bake meshes without combining materials then mesh baker will create a single combined mesh with a submesh for every distinct material used by the set of source objects.
     
  28. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    Hi Jcweeden,

    If you have multiple duplicates of the same object within a scene and all of these duplicates use the same material then there is no point in using the TextureBaker. You can just add these objects to a MeshBaker (without a texture baker) and it will combine them. The combined mesh will use the source material.

    Use the Texture Baker when you have objects in your scene that use similar shaders but different textures. The TextureBaker will combine these textures into a single shared texture. This makes it possible to combine meshes that could not be combined otherwise.
     
  29. zukinet

    zukinet

    Joined:
    Oct 30, 2016
    Posts:
    44
    Hi, thanks for suggestions... i will use Texture Packer...
     
  30. Jcweeden

    Jcweeden

    Joined:
    Mar 16, 2015
    Posts:
    6
    Perfect, I understand.

    Further to your answer - but to in order to use 'AddDeleteGameObjects()' to add additional objects into an already created, existing baked skinnedMesh requires the inclusion of a created texture in 'Texture Bake Result' in the mesh baker that is being used to add the additional skinnedMesh gameObjects? Is it possible to add additional skinnedMesh objects to an existing baked skinnedMesh without using a 'Texture Bake Result' created from the textureBaker, even if all objects added use the same material?

    I receive this error upon trying:

    ''Can't add objects if there are already objects in combined mesh when 'Texture Bake Result' is not set. Perhaps enable 'Clear Buffers After Bake'
    UnityEngine.Debug:LogError(Object)
    DigitalOpus.MB.Core.MB3_MeshCombiner:_CreateTemporaryTextrueBakeResult(GameObject[], List`1)
    DigitalOpus.MB.Core.MB3_MeshCombinerSingle:AddDeleteGameObjectsByID(GameObject[], Int32[], Boolean)
    DigitalOpus.MB.Core.MB3_MeshCombinerSingle:AddDeleteGameObjects(GameObject[], GameObject[], Boolean)
    MB3_MeshBaker:AddDeleteGameObjects(GameObject[], GameObject[], Boolean) (at Assets/MeshBaker/scripts/MB3_MeshBaker.cs:43)
    SnakeMovement:InstantiateBodyPart() (at Assets/Scripts/SnakeMovement.cs:201)
    SnakeMovement:FixedUpdate() (at Assets/Scripts/SnakeMovement.cs:88)
    '
     
  31. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    The easiest workaround would be to create a Texture Bake Result asset that has only one material in it.

    If everything uses the same material then you could clear the buffers on the baker and rebake everything. It is not possible to bake, and then add more to the baker later unless you are using the TextureBakerResult.
     
  32. noahx

    noahx

    Joined:
    Nov 22, 2010
    Posts:
    47
    Hi,
    I'm running into a situation. I had to edit this post because I was talking about two issues that I think were one at the end. Yet, the "situation" I'm experiencing it is still there. Here it is:

    When I move the camera either at some point during zooming in/out or panning, the whole texture (skinned mesh) disappears (all models with no visible mesh to the camera), and then I move the camera back and the texture/skinned mesh shows up again for all the models. It happens at certain angles, like if there was some sort of "limit".

    So, with the game still running, I went to expand the CombinedMesh-MeshBake object to reach the MeshBaker-mesh-mesh object to click whatever options were available and I checked the option named "Update When Offscreen" on the Skinned Mesh Rendered and voala, everything was visible again. So my questions now are, am I doing something wrong that I need to check that option to make it "work"? Or why do I need to use that option? I'm a bit scared that it might give me a poor performance hit because of its name.

    Thanks.
     
    Last edited: Dec 1, 2017
  33. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    171
    Now with 2017.3 and the new 32bit vertex buffer I would very like to see mesh baker make use of this new limit.
    I've already tried setting the 65535 limit higher in the code Unity freezes up so I belive there must be changed something else to get it to work.
     
  34. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    The problem is almost certainly the 'render bounds' of the newly created skinned mesh. The easiest solution is to set this to something large enough to encapsulate the combined skinned mesh in all its animation poses. Sometimes this is unknown so there are a couple of scripts in the Mesh Baker folder that will update the render bounds based on mesh positions.
     
  35. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    I will definitely investigate.
     
  36. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    A note on that -- there's a specific setting on the mesh import settings file that says whether it's using a 16 bit or (IIRC) 32 bit index. If the former, which is the default still, then it will error the same as it always did. And I believe the best use case is to continue using the smaller index int type for smaller meshes. But if it goes over that magic number, then switching to the larger index int type is probably the only step missing right now.
     
  37. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    I'm using the latest version of Mesh Baker from the asset store (I'm not sure if there are more recent betas off the website or anything like that), and I'm using Unity 2017.3 b10 at the moment. I'm baking textures via the new Standard Shader (Roughness), and then the pre-existing Standard shader.

    All seems to go quite well with this, except with normal maps. Both with this tool, and with Super Combiner, I wind up with normal map atlases that are partly correct (blue colors, not grayscale), and then in that same atlas partly a red color with a high transparency set on them. This... confuses me greatly, because I've never seen any sort of normal map format like that, and it also doesn't get read in by unity properly. I'm assuming that unity is providing the data incorrectly to these tools, or that there is something different about the files, but I don't know what to change to fix that.

    These normal maps were mostly generated in iClone, although some were generated in Substance Painter and then run through iClone and re-exported. In my case, two of them work and the rest all fail hard. Visually inspecting them in photoshop, and looking at their channels and modes and such, I don't see any differences of note.

    It's worth noting that the diffuse (with transparency, fade, and cutout), metalness, and roughness atlases all generated perfectly, doing exactly what I expected them to. The normal maps... well, honestly I'm not even sure they're arranged the same way, or scaled properly, aside from the red color with transparency.

    How do I fix that? Or is that a bug I should submit? I can upload a smallish test project on Sunday or Monday if need be.
     
  38. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    I have another, unrelated question to the one above. Basically from iClone I have 19 skinned mesh renderers (crazy, I know) using 4 different shader variants, with apparently 2 other meshes with invalid uvs (so it suggests separate materials).

    I'm trying to bake all of those down into a single skinned mesh renderer with combined materials by variant, and retain all my blend shape morphs as well as all my bones (all of the skinned meshes are attached to the same bone structure.

    I tested this, and it mostly worked. The new atlases were created, and were perfect except for the normal maps noted above. The skinned mesh renderer was created, although didn't succeed in going to a prefab because I messed up that step. When I clicked into the mesh to see what was on it, I saw blend shapes and uvs, and I assume the normals and tangents also came across, because they looked correct.

    The main problem, then, was the skeleton. I have an avatar and a skeleton in the original object, with an animator and all that, but now it's disconnected from the new skinned mesh renderer that I generated via Mesh Baker. I made a copy of the skeleton rig and copied that over and assigned it to the new skinned mesh renderer, but then the Bounds property was massively wrong. I fixed that by hand, and was about to test the new renderer with the animator and avatar copied off the old object, but on attempting to save the scene unity froze and I eventually had to force kill it.

    I'm not sure if that's a b10 bug, and I'll have to update in order to find out. They fixed some things that might be related in f1. That said, in a general sense am I going about this correctly and is this the result I should expect when it comes to rigs? If not, then possibly the reason for the freeze was me doing something stupid. ;)

    Apologies for the long narrative, but I figure that being clear about exactly what I did is helpful.
     
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    One thing to check is that the texture is marked as a normal map before baking.

    A possible workaround would be to unmark the source texture as a normal map, bake the atlases, then remark the source textures as a normal map and manually mark the created normal atlas as a normal map. This is actually what Mesh Baker tries to do because reading data from a texture marked as a normal map does not return the actual colors in the Texture2D buffer which results in a bad atlas. Mesh Baker works around this by converting the texture to a non-normal map. Creating the atlas, then re importing. It may be that unity changed the API so this doesn't work anymore.
     
    x4000 likes this.
  40. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    How did you "assign" the new rig to the new SkinnedMeshRenderer? This used to be something that could only be done with the API by assigning the bones to skinnedMeshRenderer.bones. It is important not to change the bone order since this order must match the order of bindPoses in the mesh.

    I would recommend not duplicating the rig and moving the original source bones. This will not damage the source original prefab, only the instance of it in the scene which is a copy of the source prefab. When you make the combined mesh into a prefab these bones will become part of the new prefab. Delete the scene instance of the source skinned mesh that you stole the bones from.
     
    x4000 likes this.
  41. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,051
    Hi, is there a way to divide up a mesh baker by those using standard shader opaque and those using standard shader transparent?
     
  42. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,548
    The Mesh Baker window has a tab 'list shaders in scene'. In the group-by filters you can select standard shader type which will sort the meshes according to the standard shader type. Then you can create a TextureBaker for the opaque and a TextureBaker for the transparent.
     
  43. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    That all makes good sense, thanks. Today I've updated to 2017.3f1, and I am running into the same problem but ONLY if I'm using the "fast packing" method. When I use your default pack method, it works great!

    Interestingly, symptoms of fast packing include (not that it matters to me, but just FYI):

    1. Two out of 18ish textures look like normal maps, while the rest are red and very transparent.

    2. Instead of making one normal map per material as it should, it makes only a single normal map, packed very differently, for ALL of the normal maps for all materials combined into one. Interestingly all of the other types of textures pack just fine.

    I'm a-ok with the above behavior since it's higher quality to not use the fast approach anyhow, so my purposes this is moot. Just figure I'd let you know, though.
     
  44. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Oh! Okay, that's even easier than I thought. It's not actually assigning the "root bone" property of the new skinned mesh renderer that it created from all this, so I didn't guess that it was actually linked to the old bone structure. Just copying that over works perfectly.

    Holy smokes I'm down from 98 batches to 11 for my main character. That's with just a directional light, too -- I was having 300+ batches in slightly more complex lighting with realtime GI. Absolutely murderous, but now it's actually usable!

    Thanks for the tip, and for the awesome tool. I really dislike the interface and find it unclear, although it's something that can be learned of course. But once you do learn it... wow what power. Total game-changer for characters.
     
    Ascensi and hopeful like this.
  45. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298


    Tutorial above that I created for myself that walks through the process of taking an iClone character and using Mesh Baker Pro to bake and atlas them. I already had done the one you see in the thumbnail, Ellie, which had the stats mentioned in my prior post. In this video I did Richard, who had fewer materials because he has less gear on, and so his reduction is less impressive -- though still quite notable.

    The video is longer than I meant to make it, but hopefully it helps someone else out, and either way I'll wind up referring back to it myself in the future when I inevitably forget how to do this. ;) The tool is extremely powerful, but the intuitiveness is not up there too far. Man is it powerful, though, so hopefully this helps other folks get at that power. :)
     
    Ascensi, Phong and hopeful like this.
  46. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Okay, good grief. I had a heck of a lot of trouble with the blend shapes in particular. I got it working, though. I thought I had it working after the prior video, but nope. Here's a new video:



    Video description:

    Using Mesh Baker Pro, here's a tutorial on how to blend multiple skinned mesh renderers so that they use just a single rig/skeleton and contain blend shapes that your animations can actually find. This is somewhat of a followup to my previous video, based on more recent findings of best practices.

    Note that this is a complete walkthrough of a number of different steps, so it's helpful even if you don't care about blend shapes. In this case the blend shapes were from morphs in iClone 7, but blend shapes from other programs such as Poser, DAZ, Maya, Mixamo, etc, would also all work essentially the same way.

    This is also setting up my character so that I can do hair cloth animation, or use the VertExmotion tool, without baking that skinned mesh into the main body, which would be undesirable.

    This does require one small tweak to one line of code in Mesh Baker Pro, but in future versions may not. It's an innocuous little bit of code, and I show you how to make that one change near the end of the video; otherwise the blendshapes are there, but inaccessible to animations.
     
  47. daibutsu

    daibutsu

    Joined:
    Nov 28, 2017
    Posts:
    18
    Hey guys.

    Thanks for this awesome tool.

    But i have an issue. Here i have a Ruins (combined from the different meshes) http://screenshot.su/show.php?img=071739704bddea4b81e3434fe1c1f5dc.jpg take a look on the wall.

    And when i bake it, by choosing in the hierarchy parent object http://screenshot.su/show.php?img=24f06d734ac63c3d02e1e61d4eda124d.jpg

    and adding it by pressing here http://screenshot.su/show.php?img=5d185418682e1fb6072ad4e510cfcd74.jpg

    And then i go to the baker and press bake to prefab and i have a greatly craeted prefab but without wall. http://screenshot.su/show.php?img=c63e1458e9803a8bd5374866213fe606.jpg

    What should i do?


    And one more thing. When secondly i try to include another Parent object ot baker it says it is already added to another baker. How i can maybe clear the pool of added meshes to create from the blank?

    Thanks
     
    Last edited: Dec 24, 2017
  48. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    222
    Hi. I baked multiple objects with different types of colliders on each of them. Resulted mesh has no colliders at all.
    Anybody had this issue before?
    Thanks.
     
  49. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    572
    @Phong Can triggered colliders work inside a skinned mesh full of fragments that are initially turned off ? I want to have a model with many parts explode.
     
  50. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    92
    its possible to move the objects after baking? i remenber to saw something like this but dont know if its mesh baker, some one can answer me? Thanks.