Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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,083


    If you care about performance… combine meshes, combine meshes, combine meshes!
    Mesh Baker is the ultimate mesh-combine tool, combining many meshes into one big mesh, as well as combining the textures on those objects into texture atlases and texture arrays. Mesh Baker is a powerful toolkit of flexible non-destructive workflows for optimizing props and scenes.

    Objects to be combined do not need the same material or even the same shader:
    • Works with built-in and custom shaders
    • Texture atlases are automatically generated
    • Supports URP, HDRP, Standard pipelines
    • Generate either Texture Atlases or Texture Arrays
    • UVs, Normals & Tangents automatically adjusted
    • Tiled textures can have tiling baked
    • Only parts of source textures (atlases) used by source meshes are copied to the target atlas
    • Can map multiple materials to a combined mesh with multiple materials
    • Create atlases for materials that use color tints
    • Can modify prop prefabs to use atlas materials or combine scene meshes and modify them to use atlases
    • Can create and swap parts of skinned meshes at runtime. Change clothing, add wounds, add armor.
    • Can combine many SkinnedMeshRenderers and MeshRenderers into a single SkinnedMeshRenderer
    • Can bake blend shapes of skinned meshes
    • Animations on bones remain intact
    • Can customize SkinnedMeshRenerers by adding MeshRenderer objects (hats, glasses, weapons)
    • Can generate lightmapping UVs so the combined mesh can be lightmapped
    • Control over which channels in the combined mesh are generated
    • Non-destructrive workflow. Does not touch source assets (creates new combined mesh and texture atlases)
    • Can bake into multiple combined meshes if the combined mesh would be very large.
    • Choose between five different texture packers
    • No scripting required
    • Easy to integrate into existing workflow
    • Adjust meshes and prefabs so they can share a material (take advantage of static/dynamic batching)
    • Clustering tools to easily group meshes that are close in a large scene
    • Robust, fast, mature, documented API with examples:
      • Bake materials and meshes at runtime
      • Runtime add, delete and update update objects in a combined mesh
      • Use the API in the editor to integrate meshbaker into your workflow
    Use MeshBaker To:
    • Combine meshes in your scene into one big mesh (meshes can be imported from any modeling program)
    • Easily create materials that can be shared by multiple meshes.
    • Easily create Texture Arrays and modify meshes to use them.
    • Fix models and prop prefabs so they can share a material and take advantage of static/dynamic batching
    • Customize SkinnedMeshRenderer characters (add weapons, hats, armor, clothes)
    • Combine several SkinnedMeshRenderers into one
    • Combine many dynamic low poly regular meshes into a single skinned mesh
    • Fix or adjust scaling, rotation and translation in imported meshes
    • Create a color-pallet-atlas for a groups of different props that use only color tints so that they share a single material
    Limitations:
    • Texture properties in the result material will be combined into atlases, but the other properties can't be combined. There will only be one master set of non-texture properties that applies to the whole combined mesh.
    • Baking tiling can produce large atlases or exceed the maximum size of the atlas.
    • Some meshes are difficult or impossible to combine:
      • If meshes have channels (colors, or tangents) which others do not.
      • Submeshes that share vertices and have UVs outside the range 0,0..1,1
    • If you want to combine meshes and preserve existing lightmapping, then source meshes must use the same lightmap.
    • Mesh Baker cannot combine Skinned Meshes that have "Optimize Game Object" checked in the import settings (Rig tab). This is because the bones on these objects are not exposed to be combined.
    Links
    How To Use Mesh Baker
    Basic usage:
    1. Create a new MeshBaker object in your scene under the Game.
    2. GameObject -> Create Other -> Mesh Baker -> Material And Mesh Baker
    3. Create empty assets for result material.
    4. Select shader on result material. Meshbaker will build a texture atlas for each texture property in this shader.
    5. Add objects to combine. For best results, these should use the same shader as result material, but they don’t have to. Use the provided tools to make this fast and easy.
    6. Bake combined material.
    7. Bake meshes.
    8. Look at warnings / errors in the console. Decide if action needs to be taken.
    9. (optional) Disable renderers in source objects.
    Once this has been done you can remove the MeshBaker object from the scene or keep it around for easy re-baking. If anything changes in any of your source models or textures just bake again to regenerate the combined mesh and texture atlases.

    Video Tutorials
     
    Last edited: Sep 25, 2021
    Quatum1000 likes this.
  2. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    So, what's the benefit if I already have Unity Pro? How does it compare to Unity's own Static/Dynamic Batching?
     
  3. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Unity's static/dynamic batching has a significant limitation: all objects to be combined need to use the same material. If you want to combine objects with different materials (even if they use the same shader), you need to build atlases and adjust UVs in the meshes. This is labor intensive, tedious and difficult. Mesh Baker can combine many materials into one (including combining all necessary textures into multiple atlases and adjusting UVs) in seconds.

    Unity's dynamic batching is limited to meshes with less than 300 vertices. Mesh Baker runtime API has no such limit, although at some point it becomes more efficient to render separate objects rather than to rebuild a mesh every frame.

    Mesh Baker can also bake translations, rotations and scaling into meshes.
    • When importing models from Blender, the importer applies some rotations to the model to make it line up with Unity's preferred coordinate system (y-up, z-forward, x-right). Other scripts applied to the model can be confused by these rotations. Mesh Baker can bake a perfect copy of the model that lines up with Unity's coordinate system.
    • Some models have their pivot point in an inconvenient location, such as their center instead of their base. This makes them hard to place. Mesh Baker can bake a translated copy.
    • Non-uniform scaling of meshes can mess with physics calculations. Mesh Baker can bake the scaling into a copy of the mesh which can then be used without the need for scaling.
    Some models import from 3D Modeling packages as multiple separate objects (For example a chair consists of several planes and many cylinders). Mesh Baker can combine these into a single mesh, which is much easier to work with.
     
  4. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    I see, thanks for the explanation. I will put it on my to-buy list. :)
     
  5. Itchy-Games

    Itchy-Games

    Joined:
    Jul 8, 2009
    Posts:
    221
    Is 100% compatible (without exceptions or warnings) with Unity 4?
     
  6. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Yes, Mesh Baker works with Unity 4
     
    Last edited: Nov 30, 2012
  7. Itchy-Games

    Itchy-Games

    Joined:
    Jul 8, 2009
    Posts:
    221
    Thanks for the info, pal. Maybe I will buy this soon once the fix is updated.
     
  8. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    This looks very beneficial to my project. I will also be purchasing this once you have updated it to support 4.0
     
  9. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    The update has been submitted to the asset store. It generally takes 1-3 days to be approved.
     
  10. jerryholand

    jerryholand

    Joined:
    Oct 20, 2012
    Posts:
    8
    can work with Mega-fiers?
     
  11. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    I don't have mega-fires so I can't be certain everything would work. It all depends on whether Mega-fiers edits the sharedMesh in the editor or not. I can think of a few scenarios that would work for sure:

    Things that would work for sure:

    • Runtime combining of meshes. The meshes would be combined in whatever state they are in.
    • Runtime updating a combined mesh every frame from a mega-fiers object that is being deformed every frame.
    • Editor - Using mega-fiers to deform a mesh then deleting the mega-fiers modifier component (leaving a deformed mesh). This mesh could definitely be baked in Mesh Baker.
    • Editor - Using Meshbaker to "bake meshes in place". This creates modified copies of meshes that are all capable of sharing the same material. Then you could deform these new meshes all you want with mega-fiers. After deforming you could bake these meshes together again or, if you have pro, let Unity static batching combine them.

    Things that might work:
    • Using Mega-fiers to deform an object, then baking that object while the Mega-fiers modify object component is still attached. (if this does not work it might be easy to modify Mesh Baker code so it does.)

    Things that probably do not work:
    • Using Mega-fiers UV deformation on a combined mesh or on a mesh that has been "baked in place"
     
    Last edited: Nov 30, 2012
  12. Jum

    Jum

    Joined:
    Aug 20, 2011
    Posts:
    63
    i need something like that for 3ds Max.
     
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker will work with models imported from any modeling program.
     
  14. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Great to see it released so fast!

    I wonder if it makes sense with animated meshes too, lets say I create 100 animated butterflies with skinned meshes. And they already share the same shader and texture, would it still make sense to combine the animated mesh?

    And one more question, I have a castle model from the big environment pack, it uses a few submeshes and and some of the textures of the wall are tiled, is there a way to create one mesh with 2 uv sets, one for the overall texture and another for the tiled textures?
    And optional to bake down the tiled textures into the main texture, this would cause inefficent use of texture space but might improve performance.
     
  15. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Hi Lars,

    I am planning to add support for skinned meshes soon. For skinned meshes it would make more sense to bake them all into one huge skinned mesh instead of baking into a MeshRenderer. I also hope to make it possible to bake other meshes onto a bone of the skinned mesh. This would make it possible to add an axe, sword, gun, armor, hat, glasses etc.. to a skinned mesh without extra draw calls.

    Currently I am working on better support for multiple-materials/submeshes. This allows mapping multiple input materials to multiple output materials. For example if combing many trees, you could map all the bark materials to a submesh with a combined bark material and all the leaf materials to a submesh with another leaf material.

    This new version can also bake tiling textures as you suggest. Unfortunately it can lead to large atlases. Sometimes it is better to bake:

    • All buttresses together
    • All wall sections together
    • All towers together

    This way you can keep the tiling on each one and have tiny atlases.
     
  16. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Really nice to hear that baking trees will be supported soon! This would allow for some nice performance boost on mobile as currently unity trees are just very slow on mobile.
     
  17. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker Version 1.6 has just been released. This major update includes:

    New features:
    • Support for multiple materials (can map multiple materials on source objects to multiple materials on a combined mesh)
    • Separate atlases are generated for each combined mesh material
    • Can bake tiling materials
    • Can fix models with UVs outside the range 0,1 so their UVs are in-bounds and bake tiling accordingly

    Improvements:
    • More tooltips and documentation
    • More messages describing what is going on
    • Better analysis of your scene
     
    Last edited: Nov 30, 2012
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    The new version of Mesh Baker (compatible with Unity 4) is now available in the asset store. Enjoy!
     
  19. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker now supports 4.0. I hope it works out well for you!
     
  20. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    New Features 2.0:
    • Combine skinned meshes.
    • Customize skinned meshes by combining regular meshes (swords, hats, clothes)
    • Animations remain intact after combining
    • Combined materials can be re-used in different scenes
     
  21. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
  22. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Thanks for the heads up on the asset store link.
     
  23. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    nice, going to get it
     
  24. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Here is a youtube video showing Mesh Baker combining multiple skinned meshes with animations intact and customizing the characters by adding a sword, hat and glasses to one of the meshes.

     
  25. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    I have a large city environment and the drawcalls are 150 with 250 saved by batching. I assume this would help reduce those drawcalls by combining the buildings and trees?

    Any idea what kind of difference it would make?
     
  26. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Hmm, i bought this and after having to change my textures to truecolour, I get the following error when trying to combine meshes.

     
  27. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Hmm, it appears that one of your meshes does not have normals. This is something I hadn't tested for. Which version of MeshBaker are you using? I can send you a fixed file and will get a new version up in the Asset Store ASAP. Do you want to PM me with an email address?
     
  28. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Thanks, I'm using the current version from the Asset Store.

    I'll PM you my email addy. :)
     
  29. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello...

    Does this works with Prefabs? I mean, I want to use it with objects I need to instantiate at runtime... like spawning objects/npcs, etc...

    Thanks
     
  30. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Yes, it can accept prefabs in the list of objects to combine. This is normally used to adjust mesh assets for static/dynamic batching. In your case the usage would probably look like (there is an example scene that does exactly this):

    • Use a TextureBaker to create a combined material in the editor from all possible NPC/objects.
    • At runtime create a MeshBaker object and give it the combined material
    • Add NCPs by Instantiating them then adding them to the combined mesh
    • After adding each object you probably want to keep it around with its Renderer disabled so that its physics collider remains in the scene and any scripts on the object continue to run.
    • Remove objects by removing them from the combined mesh then Destroying the object
     
  31. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Nice, thanks, looks a good tool that I need.
     
  32. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    A few little suggestions:

    - Give the new baked in place objects the same tag and layer as the source object.
    ( the ones that are using the same shader with the new mesh but are not combined )
    - Automatically use the same shader as the source object.

    The interface could benefit from having its own window, at the moment there is a lot of searching for the mesh baker in the hierarchy that could be prevented by having an open window, or docked in another tab.

    Happy to say that I got my first skinned mesh baked with success! :)


    ps I have some problem with light mapping the baked meshes, there are shadows in the wrong places, maybe it needs light map UVs?
     
    Last edited: Dec 20, 2012
  33. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Thanks for the suggestions Laars, I just submitted a new version to the asset store that addresses the lightmapping issue. It also fixes problems if channels are missing.

    Your other suggestions are good ones, and should not be too difficult to implement. I love getting feedback on peoples experiences so that I can keep improving it.
     
  34. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker 2.1 is now available. New features:

    • Can preserve lightmapping on objects when baking into a combined mesh
    • Can create a lightmapping UV layout on the combined mesh so it can be lightmapped
    • Can control which mesh channels are generated in the combined mesh
    • If channels in objects to be combined are not present then default channels are automatically generated.
     
  35. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker 2.1.1 is now available.

    New features:

    • All the inspector fields are now available in a separate editor window. This makes it easier to drag assets and objects to fields.
    • Tags and Layers are preserved in the combined mesh if all source meshes use the same tag and layer

    Bug fixes:
    • Fixed an error message that is generated if Build is set to Web Player
     
  36. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello again, last question: how does this works with Occlusion Culling? Because, if I put, for example, 4 boxes together in your backer, the occlusion will consider this a one object only, right? And so, I cannot use occlusion like it was mean... is that right?

    Any test on this?

    Thanks
     
  37. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Mesh Baker can "baker meshes in place" which works with occlusion culling and static/dynamic batching. It works like this:
    • Mesh Baker creates atlases and a combined material for a list of source objects
    • Mesh Baker duplicates the the meshes on the source objects, adjusting the UVs so they can all share the combined material. These meshes are saved as assets.
    You can now update your objects to use the duplicated meshs and combined material. Unity's static batching (which does work with occlusion culling) will combine meshes based on what is visible at runtime. You will need Unity Pro to take advantage of occlusion culling and static batching.

    If you combine all the meshs into a single big mesh then you are correct, Occlusion Culling must either cull the whole combined mesh or render the whole combined mesh.
     
    Last edited: Jan 8, 2013
  38. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Is this runtime combined or preprocess in editor?
     
  39. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    You can choose to either preprocess in editor, or combine at runtime.

    Combining at runtime requires scripting, it is quite powerful. The API is detailed on this page. You can add, remove and update meshes in a combined mesh. This is particularly useful for customizing skinned meshes (adding weapons and armor, hats etc...). If you want to combine at runtime it is a good idea to pre-process the combined material since that is slow, but combining meshs is fast enough to do in-game.
     
  40. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    Could you make a quick video showing some examples of the kind of performance boost this tool can provide please?

    e.g. A normal scene with a large number of visible meshes and skinned meshes and a frame rate counter showing the FPS, then the same scene with the meshes/skinned meshes "baked" so we can see the improved frame rate.
     
    Last edited: Jan 10, 2013
  41. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Yes, I like to see some webplayer/video to show performance/drawcall improvement. We can't preprocess combined material if it is runtime, because that defeats the purpose of combining unknown parts together.
     
  42. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Hi, I just bought this package and when I imported it I got the following 3 errors:

    " Assets/MeshBaker/scripts/Editor/MB2_MeshBakerEditor.cs(115,139): error CS0117: `MessageType' does not contain a definition for `None' "

    " Assets/MeshBaker/scripts/Editor/MB2_MeshBakerEditor.cs(110,41): error CS1502: The best overloaded method match for `UnityEditor.EditorGUILayout.HelpBox(string, UnityEditor.MessageType)' has some invalid arguments "

    " Assets/MeshBaker/scripts/Editor/MB2_MeshBakerEditor.cs(110,41): error CS1503: Argument `#2' cannot convert `object' expression to type `UnityEditor.MessageType' "

    I am using unity 4 pro and cant use the package, any help?
     
  43. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    I tested importing into Unity 4 and it worked. But I was able to reproduce the error if I created a "MessageType" class in the project. "MessageType" is a UnityEditor class. There are two solutions to this name conflict:

    • If the second MessageType class is one you created then you could change the name of it to something different. This is probably a good idea since MessageType is a UnityEditor class and you may get this error message with other packages (NGUI for example) that use it.
    • The other solution is to fix MeshBaker so all references to MessageType are fully qualified. Follow these steps to do this:
      • Open MonoDevelop and "Find In Files" for MessageType
      • In the MeshBaker source files replace all occurances of MessageType with UnityEditor.MessageType
    Please let me know if this fixes the problem. I will make this change to Mesh Baker and submit a fix to the asset store, but it can take a several days.
     
    Last edited: Jan 11, 2013
  44. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Yes perfect worked to get rid off the errors, I think it was in conflict with some server/client code we added.
     
  45. Michiluki

    Michiluki

    Joined:
    Jul 17, 2012
    Posts:
    1
    Thank you very much for this.
    Was an instant buy for me because I were working on the same thing.

    This genius asset should get a lot more attention
     
  46. Manaburn

    Manaburn

    Joined:
    Dec 13, 2012
    Posts:
    12
    I really rather like this asset, and it's saved me a lot of time / effort. Seeing something that was previously hundreds even thousands of draw calls show as 1 draw call is rather fun.

    Only issue I have is occasionally with large material / vertex counts the resultant mesh seems to have its normals flipped. I can't pinpoint the issue sometimes the mesh will work fine (say if it has 1 material on it, or 1 sub mesh from import), but the same mesh with a many materials on it (in the source program) exported (which creates lots of sub meshes in the .fbx) will import and run fine by itself, but will be complexly black if I leave "include normals" on in the mesh bake.

    Honestly, I can (and probably should) fix this another way (i.e. in the .fbx file). But there's at least some potential there's a underlying bug here (or alas in my meshes, and I'm wasting your time).
     
  47. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Thanks for the comments. It is nice to hear from people who are using the Asset. It feels strange sometimes to see that the asset has been downloaded but not to be able to contact users to see how it is working out for them.

    Regarding the problem you describe, it is tough to know what is going on. If it is possible to send me a bad mesh I could try to see what is happening. PM me if you want to try that. Here is some advice on debugging/troubleshooting:
    • A good debugging technique with submeshes is to have a set of simple materials and try these on the submeshes to see what happens. At least you can confirm if the normals are correct.
    • Try using the source material(s) on the combined mesh. The UVs will probably be mixed up, but if it otherwise displays correctly then it is probably a difference with shader properties between the source and combined materials.
    • Mesh Baker will create an atlas for every texture property in the source materials even for properties that did not have a texture assigned to them. Often this causes the combined material to behave differently than the source material if if they use the same shader. It is worth comparing the combined material with the source materials to see if the settings differ or if textures have been assigned in the combined material where they were not in the source.
    • It is worth looking carefully at warnings generated by Mesh Baker. These often provide a hint as to what might be happening.
    I will think on the description of your problem to see if I can deduce what is happening.
     
  48. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    This issue has been fixed and a the fix is now live in the asset store.
     
  49. GamePowerNetwork

    GamePowerNetwork

    Joined:
    Sep 23, 2012
    Posts:
    257
    Did I read this correctly? ... Runtime Baking? Does that mean I can create an in-game editor that allows users to select object then click combine?

    If so, I'm purchasing this right away!

    PS. Can you unbake an item at runtime? or will I have to keep an unbaked version saved if I need to revert?
     
    Last edited: Jan 19, 2013
  50. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    2,083
    Yes, there are a few example scenes included showing runtime baking. This requires scripting. This video http://www.youtube.com/watch?v=4zpR2DyRK7s shows four skinned meshes that are baked together in the editor. At runtime a fifth skinned mesh is added. There are buttons on the screen for instantiating and adding/removing a sword, hat and glasses (all MeshRenderers being added to skinned mesh).

    The baking just duplicates your meshes in the combined mesh so your original mesh and its object is still around and untouched. Whether or not you keep it around is up to you. You likely need to keep it around (with renderer disabled) if there are colliders, animations or scripts on it.

    You can remove a mesh from the combined mesh. The GameObject that the mesh-to-remove is attached to is used as the key for the remove function so you will need to keep your original object around if you want to remove it from the combined mesh later.

    Note that runtime baking of meshes is fast, but runtime baking of materials is slow (generaly 1-30 seconds unless you are combining only a few tiny textures). I would recommend building the combined material(s) for each scene in the editor ahead of time then combining the meshes at runtime.
     
    Last edited: Jan 21, 2013
    zevonbiebelbrott likes this.