Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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:
    2,062
    Hi Katasteel,

    I just did some testing. You can bake the Detail Albedo if the detail map is using UV0. The tiling does get baked correctly. You need to enter _DetailAlbedoMap in the custom property names. I am not sure if this will work if your source meshes have submeshes and/or tiling using OutOfBounds UVs but I think it will if you are using the "fix Out Of Bounds UVs" option.

    If you are using UV1 for the detail map, I don't think it will work.

    When you say "detail color" are you talking about the "color picker" box beside the MainMaps.Albedo map? If that is the case then you would need to bake that color into the Albedo main map (resulting in multiple Albedo main maps being baked into the atlas) or use the detail map as described above. I think in both cases you will end up with multiple copies of your main texture in the atlas.

    Another alternative is to add a "colors" channel to your meshes, and modify the shader to blend these vertex color values into the albedo color. This is probably the most efficient solution.
     
  2. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    hi Phong!
    i noticed that shaderforge can copy cloth component but it doesn't copy the values from source object.
    it totally makes sense why it won't copy because of the merges new mesh! but..


    am currently trying to dynamically bake a skinned mesh, all materials are baked...
    and all character body parts can be baked normally as i tested.

    but i want a certain cloth part from character body to be baked separately into a mesh that is sharing material but not merged into the rest of body new merged mesh.

    i tried baking only this cloth mesh with its cloth component, but i do not see cloth component info is being transferred to the new baked mesh!.. Surprisingly! when i copy source component cloth and apply its values to the new baked cloth mesh in editor at run rime, the cloth works fine as same as source mesh!

    am trying now to find away to copy component manually at run time, but its a pain to do through script runtime! (none scripts i used worked).

    Moreover, when i use meshbaker component to bake a character, how do i reuse same object to bake other stuff as well?
    because as soon as i remove old gameobjects from baking list, it simply effect the other baked meshes..

    thanks
     
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hmmm, I have never tried this. Would it be possible to bake the cloth SkinnedMesh in the editor so that you have a new version of that mesh that uses the new material, then add the cloth component to that? Then you have a mesh ready to go at runtime that already uses the combined material.

    If you look in the MeshBaker inspector, you can see there is a field for "Combined Mesh Object" and "Mesh". If you remove some objects to combine and add different ones then Mesh Baker will still use the same "Combined Mesh Object" and "Mesh" as before which will overwrite your previous bake. If you create a new GameObject and a new Mesh instance and assign it to these fields then your new bake will go into the new objects and your old bake will remain intact.

    If you create Meshes at runtime make sure you delete them when you are done with them or your app will leak meshes.
     
  4. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
  5. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    you just need to enter _DetailAlbedoMap. This is the name of the property in the Standard shader. If you enter that then it should create that atlas for you.
     
  6. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    53
    Hi :). Loving Mesh Baker so far, although i've run into a problem. My situation:
    1. I have GameObjects created at runtime with different mesh's assigned to them (procedurally generated).
    2. All of these GameObjects have 6 SubMeshes and 6 Materials - The materials use the same Shader but have different textures and shader properties (booleans mostly).
    3. I want to combine the Mesh's at runtime - I'm not really interested in combining materials (as they have different Shader properties I can't do this anyway) and I really just want to combine the mesh data, preserving Sub mesh's.
    So I've started with a Material Only Baker. I've enabled "Multiple Combined Materials" and created 6 Combined Materials, one for each Submesh. I've manually set up the Source and Empty materials - making sure the empty mats have the same Shader applied.

    I click 'Bake Materials into combined Material' and I get:

    "====== No problems detected. These meshes should combine well ===="
    If there are problems with the combined meshes please report the problem to digitalOpus.ca so we can improve Mesh Baker.

    Followed by

    'Creating atlases for result material combinedChunkMulti-mat (UnityEngine.Material)'

    Followed by

    'No meshes to combine. Please assign some meshes to combine.'

    Not sure why I get the final error, i'm not wanting to bake Mesh's - I just want to prep the Materials and Materials Bake Result file to be used at runtime.

    Now, inspecting the combinedChunkMulti result file it has none of the mappings i created in the Material Baker. And trying to use it to combine meshes results in:

    "Material Bake Results has no materials in material to uvRect map. Try baking materials. Can't combine meshes."

    Hope that all makes sense, Thanks!

    Aaron
     
  7. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    Thanks!
    I will try this tonight.

    How do I bake the Albedo "tint" color into the Albedo main map?
     
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi Aaron, This sounds strange. A couple of thoughts.

    Do all meshes have the same six materials or a subset of the same six materials? If so you can skip the material baking part and just bake the meshes. Just load up the MeshBaker/MultiMeshBaker with the game objects and click bake. MeshBaker. Just make sure the first object in the list has all six materials.

    If the six materials one each object are different then you will have to bake the textures. You mention that the meshes are created at runtime. Are you doing all this in the inspector while the game is running? If so that is probably the problem. The "Bake" button in the TextureBaker is trying to work with assets in the project folder. I don't believe it is possible to manipulate those assets from a running game. You need to create a "TextureBakeResult" instance (not an asset) and assign it to the TextureBaker before doing the bake. Look at the example scene "BakeTexturesAtRuntime" to see how this is done.
     
  9. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    You will need to do that in Photoshop.
     
  10. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    53
    Ah, this worked. For some reason I couldn't get it working earlier today, it's possible I was testing with an empty mesh instead of the generated real mesh's.

    Thanks buddy :)
     
  11. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Hello,
    I noticed that meshbaker was update to 3.12.3 with "adding UV2 unwrapping parameters to the UI".
    Can you please explain what this new functionality does? And what are the new options?
    Thank you.
     
  12. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi TTTTTa,

    They are the same as the settings in the Model Importer: Generate Lightmap UVs -> Advanced:

    The main one I use is "Pack Margin". I use it because sometimes when baking lightmaps with low resolution, a texel can span the 'padding' gap between UV islands. When this happens there are unsightly light and dark splotches in the lightmap bake. One fix is higher lightmap resolution. Another fix is to up the 'Pack Margin' when generating the new UV2 channel.
     
    ArachnidAnimal likes this.
  13. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    Phong,

    I am having troubles with the renderer bounds.
    I have tried a few things and nothing has worked yet.

    1)I tried to set the mesh baker renderer game object as a child of the moving object and setting the bounds (all at runtime). This sets the bounds at a different location and does not follow the object(character).

    2) Using the MB script set bounds by bones. This one didn't set the bounds at all, probably because the object is created at runtime.

    3)Using the MB script set bounds by object bounds. This one works initially but then stops when the mesh is updated(at runtime)

    Things to keep in mind is I am creating the character at runtime(all objects are parts(armor/weapons) of a character) and combining/removing "parts" to and from the MB mesh.

    Any help or insight with this problem will help.
     
  14. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi Katasteel,

    All approaches should work.

    1) The combined SkinnedMeshRenderer GameObject needs to be a child of the character root. After it has been moved, set its transform to pos 0,0,0, rot 0,0,0 scale 1,1,1 Then set its bounds. These should be in local character coordinates, not world coordinates.

    2) You will need to re-run the "Start" function of this script after the character has been created. Or destroy this component and re-add it after the character has been created. I see that the start function is not public. Edit it so that it is public if you want to try that.

    3) You will need to edit the "objects" array on this script after the character has been updated. You may also need to re-run the Start function after updating the objects list.
     
  15. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    Phong,

    The textures are losing quality and I was looking at your FAQ to try to fix it.
    I am looking for the atlas size in the console after baking the textures and I can't seem to find it.

    This is what I get when it's done:

    Created Atlases
    UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    MB3_TextureBaker:_CreateAtlases(ProgressUpdateDelegate, Boolean, MB2_EditorMethodsInterface) (at Assets\MeshBaker\scripts\MB3_TextureBaker.cs:267)
    MB3_TextureBaker:CreateAtlases(ProgressUpdateDelegate, Boolean, MB2_EditorMethodsInterface) (at Assets\MeshBaker\scripts\MB3_TextureBaker.cs:135)
    DigitalOpus.MB.Core.MB3_TextureBakerEditorInternal:DrawGUI(MB3_TextureBaker, Type) (at Assets\MeshBaker\scripts\Editor\MB3_TextureBakerEditorInternal.cs:198)
    MB3_TextureBakerEditor:OnInspectorGUI() (at Assets\MeshBaker\scripts\Editor\MB3_TextureBakerEditor.cs:22)
    UnityEditor.InspectorWindow:DrawEditor(Editor, Int32, Boolean, Boolean&, Rect&) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1231)
    UnityEditor.InspectorWindow:DrawEditors(Editor[]) (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:1028)
    UnityEditor.InspectorWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\Inspector\InspectorWindow.cs:352)
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:187)
    UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:180)
    UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:336)

    (Filename: Assets/MeshBaker/scripts/MB3_TextureBaker.cs Line: 267)

    Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 1.109558 seconds
    Refreshing native plugins compatible for Editor in 2.84 ms, found 2 plugins.
    Preloading 0 native plugins for Editor in 0.00 ms.

    ----- Total AssetImport time: 0.695428s, AssetImport time: 0.000001s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]

    Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 1.121855 seconds
    Refreshing native plugins compatible for Editor in 2.81 ms, found 2 plugins.
    Preloading 0 native plugins for Editor in 0.00 ms.

    ----- Total AssetImport time: 0.724493s, AssetImport time: 0.000001s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]

    ---------------------------------------------
    Above that all I see is the report for individual materials:

    Materials using:crates_02,
    ----------
    This set of textures will be resized to:1024x1024
    [_MainTex sacks_03_d 1024x1024]
    [_BumpMap sacks_03_n 1024x1024]
    [_ParallaxMap null no atlas will be created all textures null]
    [_SpecGlossMap null a 16x16 texture will be created with color RGBA(0.200, 0.200, 0.200, 0.500)]
    [_OcclusionMap null no atlas will be created all textures null]
    [_EmissionMap null no atlas will be created all textures null]
    [_DetailMask null no atlas will be created all textures null]

    Materials using:sacks_03,
    ---- Atlases ------
    Did not create atlas for _ParallaxMap because all source textures were null.
    Did not create atlas for _OcclusionMap because all source textures were null.
    Did not create atlas for _EmissionMap because all source textures were null.
    Did not create atlas for _DetailMask because all source textures were null.
     
  16. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I don't think it prints the atlas size to the console unless the log level is set to something less than Info. I should probably change this. It is easy to see by clicking on the combined material (click on the field and it will select in the project). Then click on the textures in the combined material to select the genarated atlases. The inspector should print the file size in the little preview window at the bottom.

     
  17. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    89
    Hey,

    I've just baked a few meshes and I've notices that all triangles get rendered even so the mesh isn't visible. The reason for that is that the generated mesh' centered is always placed at 0,0,0 and all triangles are place around that point. Now when the center of that mesh is "visible" to the camera than the whole mesh gets renderer even so the triangles are placed several units away.

    Now my question is if there's a way to generate the mesh around a custom center, e.g. by placing the GameObject with the MeshBaker script on it in the center of all meshes it has to combine?
     
    ArachnidAnimal likes this.
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    The pivot of the combined mesh is always 0,0,0. You can offset the meshes you are combining from that to achieve whatever center you like. The scale and rotation of the source meshes is also baked into the combined mesh.

    I am planning to add a feature where you can specify the desired pivot but I haven't done it yet.
     
  19. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    It is my understanding that the occlusion culling is based on the bounding box of combined mesh than unity calculates. So it doesnt matter where the pivot point is.
    Phong, could you confirm this?
    Thank you.
     
  20. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    89
    I had this problem years before and when you're inside the editor and have the Stats window open you can clearly see, that the camera starts rendering the meshes the moment I drag the pivot into the viewport. The meshes aren't visible but the triangle and vertices count increases instantly.
     
  21. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I just did a quick test. Created two cubes, moved them two units off center, baked them together. I deleted everything out of the scene except the combined mesh. Set the camera to orthographic. Then I slowly moved the combined mesh to the side and watched the Batches stat in the Stats window.

    The moment the cubes exited the view fustrum (The pivot was still in the fustrum). The stats dropped. So I believe TTTTTa is correct that the fustrum culling is based on the bounds enclosing the mesh vertices, the pivot is ignored. Try it youself.

    BTW occlusion culling is different from fustrum culling. Occlusion culling is a special optimization that can be turned on for static geometry. Unity can not render geometry that is 'behind' (hidden by) other none transparent geometry but still in the camera view.

    I think Asse1 may be referring to off screen triangles of a mesh that are rendered because at least one triangle is on screen. This is something to be aware of when combining meshes. A worst case can happen if baking two meshes together on opposite sides of a world. Any time the camera fustrum intersects the bounding box of the combined mesh (most of the time), both meshes will be rendered even though neither has any visible triangles!
     
    ArachnidAnimal likes this.
  22. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    Is there a way to combine meshes when they are not skinned but are still objects that move?

    Example: I was thinking about combining all the items(weapons, potions, scrolls, armor, etc...) in my game.
    These items pop out of chests/mobs/containers and use physics.

    Without making all the objects use skinned mesh renderers is there a way to combine them while still being able to move?
     
  23. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    If they move only occasionally. You can bake a mesh into a combined mesh, when static. Then delete it or hide it in the combined mesh and swap it for the dynamic object when it is dynamic, then re bake it when static again. This is a good strategy for things like doors.

    You can repeatedly Update the vertex positions in the combined mesh. The example scene SceneRuntimeExample does this. However it hits the garbage collector hard because the vertices must be read from the source mesh every frame. It is better to bake into a SkinnedMesh in most cases.

    Another approach is object pooling. This is a good strategy for enemies. Instead of having hundreds of enemy skinned meshes idling around a level, Most of which are waiting to be encountered. You have a small pool of enemy skinned meshes (perhaps 20 or so). As they are killed you hide them. When a new enemy is encountered, you move one out of the pool into position.
     
  24. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Hello
    Is there a way to compensate for differences in normal map strength?
    I have two materials to combine. One has a normal map strength of 1 and the other has a normal map strength of 2.
    Or do I need to regenerate the normal maps so that both materials use the same intensity prior to baking an atlas?
    Thanks
     
  25. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi TTTTTa

    Currently there is no way to compensate for the strength in the normal maps. You will need to regenerate the normal maps before combining.
     
  26. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    59
    HI Phong,
    I am doing some RnD to for an upcoming feature into our game which is a customization engine. do you have any example projects done with mesh baker that I can look at. I will basically be doing cloth customization(no body deformation) so I feel like that mesh baker is a good example that I can send to my devs to use (and hopefully save time),
     
  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi mehrankan,

    The best I have at the moment is the "SkinnedMeshRenderer" example scene. It includes a script that shows baking skinned meshes together at runtime. There is a GUI that lets the user add various meshes hat, sword, glasses etc....

    There is a suite of videos here: https://www.youtube.com/playlist?list=PLCzm-udM-shlRUy5f9QHHxqqv-9wP5FBM but nothing currently on character customization.

    There is an beta tool I have been working on "MB3_BoneWeightCopier" (included in the full version). It helps create skinned mesh parts that can be mixed and matched (arms, legs, hands etc...) by copying the bone weights at the seams to the corresponding seams in the parts to ensure that the bone-weights and positions match perfectly. This is something I found difficult and tedious to achieve in a modeler. I have included the tool in Mesh Baker. It works but could use some polish. If you do end up using mesh baker I would be interested in working with you to iron out kinks in the workflow.
     
    hopeful likes this.
  28. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    59
    thanks for the reply Phong, I hve PM-ed you some details , lets talk :)
     
  29. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    A new version of Mesh Baker has been released to the Asset Store.

    Mesh Baker has two cool new abilities that improve its atlas building capabilities:

    • When a source texture is copied to a target atlas only the part that is used by the source mesh gets copied. This is great if the source mesh already uses an atlas. It is not efficient to be copying atlas into atlases. Note that this only works if "Consider Mesh UVs" is checked.
    • Often when combining buildings the same tiled texture will be used with different tiling options on different source meshes. Mesh Baker can now detect this and map these meshes to a single shared tiled block in the atlas.
    Aside from these changes there are a few aesthetic changes.

    • "Fix out of bounds UVs" has been changed to "Consider Mesh UVs" to reflect the fact that it does not deal only with out of bounds UVs.
    • The multiple materials section now has candy striping in the inspector to improve readability.
     
    Last edited: Apr 20, 2016
  30. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    I am using mesh baker a lot in my game.

    One place that I just implemented it was to combine each dungeon room into a single mesh(down from around 24 meshes). The room count varies but is an average of about 350 rooms.

    I was able to get it to work at runtime (procedurally generated dungeon) without a problem.
    The one thing I noted is although the batches decreased from 525ish down to 250ish the framerate has dropped.

    I was getting between 50-60 fps when not combining. With combining it is more like 40-50 range.
    I checked and only the combined meshes are active.
    They are all mesh renderers, no skinned mesh renderers, and no animators.

    Any ideas why something like this happens?
     
  31. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi Katasteel,

    Have the tris and verts stat increased? That would be interesting to check.

    It sounds like you should be seeing a much bigger drop in batches 1/24th instead of 1/2. I wonder why that is happening. What lighting options are you using?

    Does the profiler report anything?
     
  32. Jog

    Jog

    Joined:
    Feb 9, 2012
    Posts:
    137
    Hello,

    I would like to ask if using Mesh Baker could give better result on VRAM overhead than using Unity batching?
     
  33. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    Today the fps seems a tad higher but still lower over all(I expected much higher than uncombined).
    Here are some screen shots:

    Uncombined:
    https://www.dropbox.com/s/3ttl9zoxyitgw7t/BeforeCombine.JPG?dl=0

    Combined:
    https://www.dropbox.com/s/r3imwha4lehybbw/AfterCombine.JPG?dl=0

    I have built and tested both on 3 different computers and all prefer the uncombined for some reason.
    Maybe because there is now about 350+ more game objects in the scene?
    Not really sure.

    P.S. After running it a few more times I am noticing the Tris and Verts are much higher.
    Here are two more SS's when standing in the same position(starting position).

    https://www.dropbox.com/s/6h4jn0i0mgojjga/BeforeCombine2.JPG?dl=0

    https://www.dropbox.com/s/6hpdpowmyfhutt3/AfterCombine2.JPG?dl=0

    I may very well be doing something to make this happen.

    So here is what I want to do.
    I want to be able to create a combined mesh at runtime.
    I am passing in all the game objects that have been added to the room.
    Here is my code, it seems to work but maybe it is somehow combining the objects twice(Although by reviewing your code I don't think it's possible)?

    Code (CSharp):
    1.         public void Fire()
    2.         {
    3.             if (meshBaker == null)
    4.                 return;
    5.  
    6.             for (int i = 0; i < meshBaker.objsToMesh.Count; i++)
    7.             {
    8.                 if (meshBaker.objsToMesh[i] != null)
    9.                 {
    10.                     objsToAdd.Add(meshBaker.objsToMesh[i]);
    11.                 }
    12.             }
    13.  
    14.             meshBaker.objsToMesh.Clear();
    15.             meshBaker.AddDeleteGameObjects(objsToAdd.ToArray(), null, true);
    16.             meshBaker.Apply();
    17.         }
     
    Last edited: Apr 24, 2016
  34. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I don't think the VRAM overhead will be much different. The approaches are very similar once the meshes have been combined.
     
  35. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    The code looks good. By any chance is VSynch turned on? That would explain being locked around 60 FPS.

    Have you tried selecting some of the combined meshes to see what the bounds are like? It may be that some very large meshes are being baked into some of the combined meshes which is causing them to always intersect the view fustrum. That would explain the extra tris.

    What is your target platform? Testing on a PC can be very misleading if your target platform is mobile. Also testing different PCs can give wildly different results. If you have a powerful GPU then 600 drawcalls is not a huge number. It may be that GPU is able to easily render the scene in both cases. How does it look in the profiler? I notice from the stats window that the GPU time has increased but the CPU time has decreased.
     
  36. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    I turned off the vsync and the combined version was only returning around 50 fps this time.
    There are no bounds because they are mesh renderers not skinned.
    I'm at a loss, when I look at the mesh(double click on it) it looks fine. I can't think where the extra tris are coming from.
     
  37. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    114
    Sorry if this has been asked before but I don't think its mentioned anywhere obvious,

    Can this combine multiple unskinned meshes into a single skinned mesh? I have 60 individual models with a complex animation and I want to change it so its 1 skinned model with each of the original models' verts being bound to a single bone (its original transform)
     
  38. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi popMark,

    Yes it can. just follow the regular instructions but set the "Renderer" field to "skinned mesh" on the mesh baker. The example scene "SceneRuntimeExample_skinnedMesh" does this. You should be able to do this with the free version.

    This tutorial video shows the functionality.
     
    Last edited: Apr 25, 2016
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I will give this some thought. They must be renderers that are being culled when meshes are separate but are included in the baked meshes. Are the combined meshes localized or do they overlap each other significantly.
     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,625
    Ah, so a use for this might be when you're fragmenting a building ... ? That way you can have a bunch of small dynamic objects but still mesh combined.
     
  41. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    334
    So I tried to just combine a room (not at runtime but in the editor) and looked at the created mesh.

    The created mesh has 13946 verts and 10754 tris.
    I'm wondering it the reason I am getting the lower framerate and higher tris is because...
    If I don't combine the meshes and only 4 pieces of the room are showing I only get the tri count for the 4 parts.
    But, if the room is combined and same view is used it will give the full tri count for the mesh.

    I don't know that this is the case but it seems possible.
     
  42. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,625
    My apologies if I'm misunderstanding ... but you have to be careful with your mesh combining versus your occlusion processing. Mesh combining will defeat your OC if you combine too many meshes.

    Maybe break each room up into smaller chunks, and combine those? So that in most cases only two chunks are seen at a time?
     
  43. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I will give this some thought. They must be renderers that are being culled when meshes are separate but are included in the baked meshes. Are the combined meshes localized or do they overlap each other significan
    Yes, that is a good use. I used a Mesh Baker skinned mesh to create the smashing glass effect 1:33 in this video.
     
    hopeful likes this.
  44. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    This could be the case. What are the clipping planes set to for the camera? Could it be that the view fustrum is much larger than it needs to be?
     
  45. Pequisto

    Pequisto

    Joined:
    Apr 21, 2015
    Posts:
    66
    Hi,

    I currently have a 16km x 16km terrain divided by 500m x 500m tiles. Each tile is dynamically loaded depending on the player's transform. I'm looking at Mesh Baker to see if there's any possibility of lowering my project's draw calls which is insanely high thanks to SpeedTrees.

    Is this a possibility?


    Thanks!
     
  46. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    I think you would need Mesh Baker and Mesh Baker LOD for this. However I have not yet added code to mesh baker for handling billboard renderers. This is a big problem for speed trees because they like to use billboards for the most distant LOD level.

    Other than the billboard renderer problem Mesh Baker with Mesh Baker LOD should be able to handle the situation you describe. I expect to add support for billboard renderers over the next month.
     
    Pequisto likes this.
  47. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi Everyone,

    I have started to look into adding support for BillboardRenderers. It is much more difficult than originally anticipated. It looks like the API is incomplete. It is not possible to access the mesh through the API which will make combining these impossible. It looks like BillboardRenderers are an internal part of the SpeedTree implementation and too much of the API is hidden to be able to use them for anything else. It is not even possible to create BillboardRendererAssets in Unity. They can only be created using SpeedTree.
     
  48. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    hi phong,

    i noticed in your asset scripts, there are many comments of "TODO" in your scripts... is it possible to remove them from the submitted asset store version?

    am currently keeping track of my personal todo list as well... and using tool that read out my scripts and display them as list in editor... :)
    it's just your comments gets mixed up with mine haha..
    i do removed yours "todo" manually.. but u know.. just to let you know for future updates.
     
  49. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Will do. Hadn't considered that but it is a good point.
     
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,062
    Hi Everyone,

    I have uploaded a new version of Mesh Baker with improved Character Customization features. If you have ever wanted to create skinned mesh characters that can change clothing or loose an arm then this is for you. I have created a new tutorial video showing how the features work. I would recommend watching it since this was trickier than I thought it would be.

     
    docsavage likes this.