Search Unity

Mesh Baker by Digital Opus [RELEASED]

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

  1. Bluestek

    Bluestek

    Joined:
    Jan 11, 2013
    Posts:
    8
    Thanks for the quick response. I think I need to give you a bit more info. The hat is a single mesh with two submeshes, each submesh has a material using the standard shader, on each material only the albedo texture was changed using a 64x64 solid color texture. I tested using the "consider non-texture properties" by removing the textures and just using the color value of the materials to control the color with similar results. When making a model with a submesh do the UVs need to be cut along the submesh divisions?

    I can send you the model it that would help!

    Thanks for your support,
    Julius


    BlendSourceColor.PNG
    Texture.PNG
    test-mat-_MainTex-atlas0.png
     
    Last edited: May 7, 2018
  2. Duffer123

    Duffer123

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

    A few more questions re this asset which I am considering purchasing.

    Let's say I had a couple of body skinned meshes (same rig/skeleton/weighting) - let's say a 'muscular' person and a 'thin' person - both skinned mesh body - both with say different materials.

    Q1 - Could I create in runtime a new skinned mesh body based on say 20% of muscular body and 80% of thing body?

    Q2 - Could I create in runtime a new material for the new body skinned mesh with say 20% of one (bearded face on body material ) material for first mesh and 80% of second (clean shaven face on body) material for second mesh?
     
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Thanks for sending the photos with more detail. I can now see the color bleeding. Try a couple of things:

    1) increase the padding and use the "resize power of two textures".
    2) a likely cause of this is the bilinear filtering that Unity is using on the atlas. Unity is blending the color for neighboring pixels which is bad at the edges. Select the generated atlas texture in the project and in the inspector switch the "filter mode" setting to "point (no filter)".
     
  4. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    No, these things would be hard and Mesh Baker would not help with this. You could accomplish Q1 (without Mesh Baker) by using blend shapes. Have a thin morph target and a muscular morph target then you could morph between them by setting the blend weight.

    Q2 would also be hard. The only way I can think of to do this would be to write a custom shader that has a two versions of each property and an extra "blend weight" property that blends between them for each property value in the shader. If performance matters for your platform you could use your "blended" shader to generate render textures which would be used by a regular (non-blended) texture. You would only update the render textures when the "blend weight" property changes.
     
  5. Bluestek

    Bluestek

    Joined:
    Jan 11, 2013
    Posts:
    8
    Thanks again for the help!

    Doing as you suggest, resize power of two, more padding, and point filter does help but doesn't match completely.
    The only way I found to get the gold band to align properly is to make UV seams along the edges of the submeshes. I'll look into making this process dynamic.
     
  6. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    If you want to send the model to contact.digitalopus@gmail.com. I would be happy to take a look.

    One other thing that might help is using "consider UVs". It may be that the UVs are a over the 0..1 by a tiny amount which could cause this.
     
  7. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    Is there a way to get the baked mesh in the free version other than doing a Find for the meshes string? ATM I'm using this to grab it and rename it:
    Code (CSharp):
    1. string bMeshName = "Baked Character Mesh";
    2.         bakedMesh = GameObject.Find(meshBaker.name + "-mesh-mesh");
    3.         if (bakedMesh == null)
    4.             bakedMesh = GameObject.Find(bMeshName);      
    5.         if (bakedMesh.name != bMeshName)
    6.         {
    7.             bakedMesh.name = bMeshName;
    8.         }  
     
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Yes:

    meshBaker.meshCombiner.resultSceneObject
     
  9. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    I probably should have tried it before saying anything. Actually, that returns the object that the mesh is a child of and not the object itself.
     
    Last edited: May 8, 2018
  10. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    This still is not working for me. It returns the parent object that my mesh object was made under instead. Does it only work if the baked mesh object (the object that holds the new skinned mesh renderer) is not a child of something?
     
  11. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    It should be the parent of the GameObject with the skinnedMeshRenderer component after the bake. If you have moved the hierarchy around after baking then that may not be true anymore.

    There is another field: targetRenderer which is the renderer component of the combined mesh. You can get the game object using:

    meshBaker.meshCombiner.targetRenderer.gameObject
     
  12. mlaibow

    mlaibow

    Joined:
    Feb 5, 2014
    Posts:
    40
    I am having an issue with the bounding box on skinned meshes built at runtime with MeshBaker. I have a collection of objects that in the editor I use Texture Baker to create a single material collection, then at runtime I add all the objects to a SkinnedMesh with MB. For the most part this has been working great.
    However, I often get 999+ Assertion Failed: AABB errors that crash the game in the editor, although it does not crash them in a build, probably because it is not the error as much as the reporting of the error to the console that crashes the game.
    I think I get these errors when the individual chunks move faster than the skinned mesh renderer can update the bounding box, and so I get these AABB violations.

    In order to attempt fix this, I have added this code to the script that has created the skinned mesh:
    Code (CSharp):
    1.     void Update () {
    2.         if (this.gameObject.GetActive() && available == false) {
    3.             if (skinnedMeshRenderer != null && objsList != null) {
    4.                 MB3_MeshCombiner.UpdateSkinnedMeshApproximateBoundsFromBoundsStatic(objsList, skinnedMeshRenderer);
    5.             }
    6.         }
    7.     }
    8.  
    It seems to reduce the amount of times I get this error, but it still happens.
    Any ideas for how to fix this error would be great? Can I manually set the bounding box to something huge on the skinned mesh renderer that I create at runtime with MB?
    Can I speed up the update of the bounds so that it moves as fast as the physics engine updates the positions of the objects?

    Thanks for reading this, any help would be appreciated.
     
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Did a bit of googling about Invalid AABB errors and they appear to be related to physics. Note that the bounding box for the skinned mesh renderer is not used for physics. It is only used for rendering. As a test I would test disabling the SkinnedMeshRenderer but allowing the physics to play normally and see if you still get these errors.

    If the error is caused by the skinned mesh bounding box take a look at the scripts MB2_UpdateSkinnedMeshBoundsFromBounds.cs or MB2_UpdateSkinnedMeshBoundsFromBones.cs to see how to set the bounding box on the skinned mesh renderer. Note that there was a bug for a while with Unity that may still be there where changing the bounds doesn't have any effect unless you set and unset the updateWhenOffscreen field.

    If this is a physics error then the cause must be related to the bounding box for the physics colliders. From the posts I have seen it looks like this could be related to:
    • Invalid scale on physics colliders. Any chance you could have negative or zero scale values on a transform that has a child collider?
    • Something to do with how rigid bodies are instantiated.
    • Some people report this error with particle systems.
     
  14. LuvthelUNatic

    LuvthelUNatic

    Joined:
    Mar 15, 2018
    Posts:
    3
    Hello,I am Japanese, so English is not good, but I have a question.
    I want to combine materials, but if you select 5 objects and bake them, you can only material on topmost object.
    I have made Bake successful in the past, why can not I do this time.
     
  15. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    I am not certain what the problem could be. Here are some things to check:

    1) Check that all 5 objects are added to the list of Objects To Combine.
    2) Check the shader on the Result Material. Do the other four objects use a material with a very different shader? Atlases will be created for each texture property on the result material. If the other source materials use different texture properties, atlases will not be created for those properties.
    3) Check the console after baking textures. Usually there are messages if something is excluded for some reason.
    4) Check the combined material after combining. Can you see the different source textures in the atlas?

    If the atlas looks good but the textures on the combined mesh are not in the right places, try using the "Consider UVs" feature.
     
  16. LuvthelUNatic

    LuvthelUNatic

    Joined:
    Mar 15, 2018
    Posts:
    3
    I am sorry to tell you the problem.
    Materials are all the same Standard and were specified when joining 5 together.

    Three out of five are the same material (material called phong).
    I posted the result image so please watch it.

    Applying this material to the combined mesh will stain with phong 1 at the top.

    Also, if you rearrange the order of the five objects you select when combining, only the material at the top of a different color from the previous one will be.
     

    Attached Files:

  17. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Do these materials have textures or are you just using the color tint box. If you are using the color tint box, try using the "Blend non texture properties feature". If you use that then it should work.
     
  18. LuvthelUNatic

    LuvthelUNatic

    Joined:
    Mar 15, 2018
    Posts:
    3
    Thank you very much! I was able to complete the correct process.
    I appreciate polite support and this wonderful tool.
     
  19. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,838
    What I'm constantly struggling with when using MeshBaker is figuring out how to control the pivot position of the combined meshes. I'm not sure what keeps going wrong but the pivot position of the combined mesh is not sufficient. I need the object to rotate around itself during runtime.

    It seems like there should an input field in the meshbaker utility to specify what the exact pivot point should be of the combined mesh so we don't have to be moving and repositioning items before doing a mesh bake.
     
    Last edited: May 29, 2018
  20. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    There is a checkbox on the Baker "Center Mesh To Render Bounds". It will adjust the position of vertices so that that the mesh is centered about the render bounds center. This may not give you enough control. I will take a look a that code to see if it can easily modified to allow a custom point to be specified.
     
    ArachnidAnimal likes this.
  21. jeroenvandermeulen

    jeroenvandermeulen

    Joined:
    Mar 23, 2018
    Posts:
    6
    Hi @Phong ,

    I've been using the "BakeTexturesAtRuntime" script for objects that use one material with success, however I would also like to bake textures at runtime for objects that use multiple materials/shaders. Is it possible for you to create a similar example script for this?
     
  22. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    I will try to put something together over the next day or two.
     
  23. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Here is an example script that bakes multiple materials at runtime:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using DigitalOpus.MB.Core;
    5.  
    6. /*
    7. * For building atlases at runtime it is very important that:
    8. *         - textures be in trucolor/RBGA32 format
    9. *         - textures have read flag set
    10. *
    11. *
    12. * It is also Highly recommended to avoid resizing
    13. *      - build padding into textures in editor
    14. *      - don't use padding when creating atlases
    15. *      - don't use tiled materials
    16. *
    17. * If you are having problems look at the Debug Log on the device
    18. */
    19. public class BakeTexturesAtRuntimeMultiMaterial : MonoBehaviour {
    20.     public GameObject target;
    21.     float elapsedTime = 0;
    22.  
    23.     void OnGUI(){
    24.         GUILayout.Label("Time to bake textures: " + elapsedTime);
    25.         if (GUILayout.Button("Combine textures & build combined mesh all at once")){
    26.             DoBakeTextures();
    27.         }
    28.     }
    29.  
    30.     void DoBakeTextures()
    31.     {
    32.         MB3_MeshBaker meshbaker = target.GetComponentInChildren<MB3_MeshBaker>();
    33.         MB3_TextureBaker textureBaker = target.GetComponent<MB3_TextureBaker>();
    34.  
    35.         // We need to map materials on the source objects to the result materials.
    36.         // One way to do this is using the shader
    37.      
    38.         // first collect all the materials used by the source objects
    39.         List<Material> allSourceMaterials = new List<Material>();
    40.         for (int i = 0; i < textureBaker.GetObjectsToCombine().Count; i++)
    41.         {
    42.             Renderer r = textureBaker.GetObjectsToCombine()[i].GetComponent<Renderer>();
    43.             allSourceMaterials.AddRange(r.sharedMaterials);
    44.         }
    45.  
    46.         // now group these by shader
    47.         Dictionary<Shader, MB_MultiMaterial> sourceMatsGroupedByShader = new Dictionary<Shader, MB_MultiMaterial>(); // track which shaders we have found
    48.         for (int i = 0; i < allSourceMaterials.Count; i++)
    49.         {
    50.             // if we haven't run into this shader before then create an empty collection so we can add it
    51.             if (!sourceMatsGroupedByShader.ContainsKey(allSourceMaterials[i].shader))
    52.             {
    53.                 MB_MultiMaterial multiMaterial = new MB_MultiMaterial();
    54.                 Material newCombinedMaterial = new Material(allSourceMaterials[i]);
    55.                 newCombinedMaterial.name = "CombinedMaterial" + allSourceMaterials[i].shader.name;
    56.                 multiMaterial.combinedMaterial = newCombinedMaterial;
    57.                 multiMaterial.sourceMaterials = new System.Collections.Generic.List<Material>();
    58.                 sourceMatsGroupedByShader.Add(allSourceMaterials[i].shader, multiMaterial);
    59.             }
    60.  
    61.             // add the source material to the correct group.
    62.             MB_MultiMaterial multiMaterialForShader = sourceMatsGroupedByShader[allSourceMaterials[i].shader];
    63.             if (!multiMaterialForShader.sourceMaterials.Contains(allSourceMaterials[i]))
    64.             {
    65.                 multiMaterialForShader.sourceMaterials.Add(allSourceMaterials[i]);
    66.             }
    67.         }
    68.  
    69.         // convert this to an array
    70.         MB_MultiMaterial[] sourceMatsGroupedByShaderArray = new MB_MultiMaterial[sourceMatsGroupedByShader.Count];
    71.         int idx = 0;
    72.         foreach (MB_MultiMaterial v in sourceMatsGroupedByShader.Values)
    73.         {
    74.             sourceMatsGroupedByShaderArray[idx] = v;
    75.             idx++;
    76.         }
    77.  
    78.         // Now configure the texture baker
    79.         textureBaker.textureBakeResults = ScriptableObject.CreateInstance<MB2_TextureBakeResults>();
    80.         textureBaker.resultMaterial = new Material(Shader.Find("Diffuse"));
    81.         textureBaker.doMultiMaterial = true;
    82.         textureBaker.doMultiMaterialSplitAtlasesIfOBUVs = false;
    83.         textureBaker.doMultiMaterialSplitAtlasesIfTooBig = false;
    84.         textureBaker.resultMaterials = sourceMatsGroupedByShaderArray;
    85.  
    86.         // Bake the textures.
    87.         float t1 = Time.realtimeSinceStartup;
    88.         textureBaker.CreateAtlases();
    89.         elapsedTime = Time.realtimeSinceStartup - t1;
    90.  
    91.         // Bake the meshes.
    92.         meshbaker.ClearMesh(); //only necessary if your not sure whats in the combined mesh
    93.         meshbaker.textureBakeResults = textureBaker.textureBakeResults;
    94.      
    95.         //Add the objects to the combined mesh
    96.         meshbaker.AddDeleteGameObjects(textureBaker.GetObjectsToCombine().ToArray(), null, true);
    97.         meshbaker.Apply();
    98.     }
    99. }
     
  24. AdamCrockettCAE

    AdamCrockettCAE

    Joined:
    Mar 16, 2018
    Posts:
    5
    I'm getting the error

    Assets/MeshBaker/scripts/Editor/core/MB3_TextureCombinerEditorFunctions.cs(42,41): error CS0117: `UnityEditor.EditorUserBuildSettings' does not contain a definition for `tizenBuildSubtarget'

    Running unity 2018.2.0b2
    upload_2018-6-8_8-55-2.png
     
  25. AdamCrockettCAE

    AdamCrockettCAE

    Joined:
    Mar 16, 2018
    Posts:
    5
    commented out tizen build targets per coworkers suggestion. Works now.
     
  26. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Thanks for letting me know. I will fix that in the next update.
     
  27. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Help please :/

    System.NullReferenceException: Object reference not set to an instance of an object
    at DigitalOpus.MB.Core.MB3_TextureCombinerPackerOneTextureInAtlas.CalculateAtlasRectangles (DigitalOpus.MB.Core.TexturePipelineData data, Boolean doMultiAtlas, MB2_LogLevel LOG_LEVEL) [0x000c8]
     
  28. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Are you using the free version? I am looking at that method in the file. It looks like there is only one part of that method that can be null. If you have the full version you can change the code so it reads as bellow. That should fix the problem. If you are using the free version I will need to push a fix which takes a few days. It looks like the error is happening because there is only one texture in the atlas and the texture is null. If you add a texture (a very small solid color texture). The error should go away:

    File MB3_TextureCombinerPackerOneTextureInAtlas.cs
    Code (CSharp):
    1.         public AtlasPackingResult[] CalculateAtlasRectangles(MB3_TextureCombinerPipeline.TexturePipelineData data, bool doMultiAtlas, MB2_LogLevel LOG_LEVEL)
    2.         {
    3.             Debug.Assert(data.OnlyOneTextureInAtlasReuseTextures());
    4.             if (LOG_LEVEL >= MB2_LogLevel.debug) Debug.Log("Only one image per atlas. Will re-use original texture");
    5.             AtlasPackingResult[] packerRects = new AtlasPackingResult[1];
    6.             AtlasPadding[] paddings = new AtlasPadding[] { new AtlasPadding(data._atlasPadding) };
    7.             packerRects[0] = new AtlasPackingResult(paddings);
    8.             packerRects[0].rects = new Rect[1];
    9.             packerRects[0].srcImgIdxs = new int[] { 0 };
    10.             packerRects[0].rects[0] = new Rect(0f, 0f, 1f, 1f);
    11.  
    12.             MeshBakerMaterialTexture dmt = null;
    13.             if (data.distinctMaterialTextures[0].ts.Length > 0)
    14.             {
    15.                 dmt = data.distinctMaterialTextures[0].ts[0];
    16.  
    17.             }
    18.             if (dmt == null || dmt.isNull)
    19.             {
    20.                 packerRects[0].atlasX = 16;
    21.                 packerRects[0].atlasY = 16;
    22.                 packerRects[0].usedW = 16;
    23.                 packerRects[0].usedH = 16;
    24.             }
    25.             else
    26.             {
    27.                 packerRects[0].atlasX = dmt.width;
    28.                 packerRects[0].atlasY = dmt.height;
    29.                 packerRects[0].usedW = dmt.width;
    30.                 packerRects[0].usedH = dmt.height;
    31.             }
    32.             return packerRects;
    33.         }
     
  29. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Hi thanks for the reply. I'm not using the free version, this is in the paid version specifically when trying to combine Unity Asset RealToon shader using objects.

    I'm wondering how to bypass this because the scene heavily relies on this particular shader but has overall caused waaay too many problems in terms of lighting, optimization, etc.
     
    Last edited: Jun 23, 2018
  30. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Does the code I posted fix the problem? Try replacing the function: CalculateAtlasRectangles in file:
    MB3_TextureCombinerPackerOneTextureInAtlas.cs

    This should fix the issue.
     
  31. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Hi! I forgot to reply!
    Thanks for your help.

    Eduardo
     
  32. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Hi, thanks for the reply, I'm sorry I thought you meant the script was only specific to free version.

    This fix allows meshes to be combined but doesn't atlas RealToon Shader textures, it works fine on any other shader.

    What happens is only the first texture in the material array appears in the atlas, all other textures are ignored and do not appear, there is also no resizing etc.
     
    Last edited: Jun 25, 2018
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086

    This could be one of two issues.
    • The shader on the result material is not set to "RealToon" shader
    • The texture properties on the "RealToon" shader have unusual names
    Unfortunately Unity doesn't allow a material to be queried to get the list of texture property names. Mesh Baker works around this by having a list of usual properties that it looks for.

    You can extend this list by adding the names of the texture properties in the list of _CustomPropertyNames. I would check the RealToonShader to see what the names of the properties are. If they not on this list then add them to the list of Custom Property Names:

    "_MainTex"
    "_BumpMap"
    "_Normal"
    "_BumpSpecMap"
    "_DecalTex"
    "_Detail"
    "_GlossMap"
    "_Illum",false),
    "_LightTextureB0"
    "_ParallaxMap"
    "_ShadowOffset"
    "_TranslucencyMap"
    "_SpecMap"
    "_SpecGlossMap"
    "_TranspMap"
    "_MetallicGlossMap"
    "_OcclusionMap"
    "_EmissionMap"
    "_DetailMask"
     
  34. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    I think unusual names are going to be the culprit here, I'm wondering if there's a way to atlas the textures on a standard shader and then switch the shader to RealToon.

    I'll have to check it out and see whether this is possible.

    Thanks again for the help!
     
  35. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    @Phong , there's still a limitation on 64k vertices meshes (on mesh bake generation).
    Is it possible to add the option to generate bakes with 32bit indexformat, so as to have larger individual meshes?
     
  36. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    This is something that should be working. I have a passing unit test that bakes a mesh using more than 64k vertices. What is the scenario where you are encountering a problem?
     
  37. Kripll

    Kripll

    Joined:
    Jan 20, 2017
    Posts:
    7
    Hello. How mesh bake in build so that in place there are two objects left, the source and the object with a merged grid?
    In Unity this job if press button "Bake".
    upload_2018-6-28_17-57-49.png
     

    Attached Files:

  38. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Hi Kripll, I am not certain what question you are asking but I will try to answer.

    If you would like to remove the MeshBaker object from the scene after you bake objects you can simply delete the Game Object with the MB3_MeshBaker component attached. Doing this will not have any affect on the source object and will not remove the combined mesh object from the scene.

    If you are asking how to use Mesh Baker I would suggest that you look a the tutorial videos and the Manual.

     
  39. Kripll

    Kripll

    Joined:
    Jan 20, 2017
    Posts:
    7
     
  40. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    hi i used your evaluation version and i find this tool very complicated to use, also it seems that your videos doesn't match with current version. Its odd that it didn't turned out as expected. Perhaps more user friendly and simple solution will he highly appreciated. Thanks
     
  41. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    You're right! Just needed to update to latest version.
     
  42. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Hi Kripll, unfortunately I do not speak the language of this post so I do not know how to respond if this is a question.
     
  43. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Phong, the issue I'm having now is if on MeshBaker, I set Generate_new_UV2_layout (for big meshes), I'm getting "SetPerIndexUVs failed because the output has >64K vertices" (Unity 2017.3)
    Is it possible Unwrapping.GenerateSecondaryUVSet() do not support this king of meshes?
    My workaround is MultiMesh, but I'm trying to reduce DrawCalls to a minimum.

    Thks!
     
  44. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    I had not tried using GenerateSecondaryUVSet with meshes larger than 64K. It is possible this does not work. I will give it a try later today. You could try "Copy UV2 to separate rects". This will copy the UV2 channel from your source meshes but shift them so they don't overlap. The only issue is that your source meshes need a valid UV2 channel.
     
  45. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Thks, as usual! Already tied. Unfortunately, on my actual project, most of my source meshes don't have UV2 channels enabled.
    I hope this can be fixed in the future.
     
  46. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Some time ago, I had the same feeling, and just used the basics. Till I needed more tunnings on my development, and was forced to study and test a little more (docs and forums). Now, I don't imagine a project without this enhancements.
    Moreover, simpler tools may give you faster results, but by far, not as good as this ones. The aparent complexity gives you flexibility. I recommend you giving it more chances.
     
  47. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    I have tried several times with different materials and i failed everytime. I dont know what to do.
     
  48. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Is there a way to merge mesh colliders with this tool? I'm creating a track editor and need to merge the colliders of all my pieces.

    Thanks!
     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    It does not work directly with Mesh Colliders. There is a workaround. You can create a bunch of temporary MeshRenderer/MeshFilter game objects and add the Mesh Collider meshes to those Mesh Filters. Combine. Use the combined mesh with a new Mesh Collider. Delete all the temporary Mesh Renderers and Mesh Filters.

    Note that is is good practice with physics to use lots of small mesh colliders rather than a few large ones. This provides a workaround for the issue that physics likes convex colliders. You can make a concave shape by assembling several convex colliders. Also the performance is better because culling collisions between objects is less likely to have false positives and if there is a collision, finding the contacts is faster with fewer triangles.
     
    Meltdown likes this.
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,086
    Can you provide more information about the materials you are trying to combine? Also Mesh Baker provides a lot if information in the console about the meshes and materials. This usually provides insight as to why things may not be working.