SkinnedMesh Combiner
Definitions
- Combine Mode
SkinnedMesh Combiner offers 4 different combination behaviours. They are:
- Combine and Replace
Takes the target GameObject, combines it and replaces the original object
- Combine to New
Creates a combined clone of the target GameObject, leaving the original alone
- Combine to Prefab
Creates a prefab asset of the combined object
- Combine on Start
Only available in the skinned mesh combiner component
Triggers a default combination on start
This is not recommended for production, as mesh combination is computationally expensive
- Draw Call
A draw instruction sent to the GPU. A packet of data describing the object the GPU has to draw, where it is, and the material used to render it.
In the most common circumstances, each mesh and material are a single draw call.
By combining meshes together and combining their materials, the entire drawing of an object can be sent in a single draw call!
- Root SkinnedMeshRenderer
The user-defined root of the mesh combination operation
The root Skinned Mesh Renderer will define the following things about the combined result:
Texture Resolution
Armature (discounting any virtual bones)
Material instance (will be assigned a combined texture if applicable)
- Virtual Bones
When combining meshes onto an armature, the "create virtual bones" option will create new bone transforms as needed to map meshes without any bone weights onto
For example, a sword being combined onto a character mesh will use its transform as a bone for skinning. This allows you to move the bone around as you wish and even disconnect it from the armature
This allows you to add new meshes onto existing armatures and be involved in their animation, dynamically
User Guide
Combining Meshes
Attach a SkinnedMeshCombinerComponent to the parent of the SkinnedMeshRenderers / MeshRenders you wish to combine
Tweak and assign desired settings
Generally the auto-detect feature can find and assign the appropriate meshes and settings
Otherwise, you can manually assign / change any settings and reorder the collection of meshes as needed
Choose which
Click generate!
Create Virtual Bone for a Single Mesh
Turn off "Create Virtual Bones"
Keep the meshes that you don't need to move dynamically as children of the armature
Take the thing you want to operate as a virtual bone out from under the armature entirely
Combine the meshes
Move that GameObject back under the bone parent you want it to follow
Notes
ALL meshes and textures involved in combining MUST have Read/Write enabled.
For the model, it's under the first 'Model' tab
For textures it's under the 'Advanced' foldout
All textures for each mesh, if you wish them to be combined, must share the same dimensions. As mentioned, this dimension is set by the root SMR
For example, if the root SMR has a texture with a dimension of 256x256, the texture combiner will expect all the others to be as well, so they can fit onto a uniform texture atlas
The texture atlas will create an atlas from the textures it finds in each renderer's material, from left to right, bottom-up. Though it usually has no effect, if you need to control the order of textures it is based on the order of renderers in the component renderers to combine collection. So, the first renderer's texture will be at the bottom leftmost square on the atlas (0, 0) then the next will be (1, 0) and so forth.
Textures are expected to be uniform in size, ex. 256x256, 512x512, 1024x1024...
Only a single blendshape (shape key) frame is supported
A single frame In Blender is in the range (0-1), and (0-100) in the Unity editor.
This tool is ideally intended to be used to combine SMRs with eachother or SMRs with MRs. Unity provides a built-in method for combining regular meshes (no skinning, boneweights or blendshapes) which is Mesh.CombineMeshes(), so if that's what you need I recommend using that instead.
If you have any questons, comments or concerns you can reach me at awtdevcontact@gmail.com