All Projects → joshcamas → skinned-mesh-combiner

joshcamas / skinned-mesh-combiner

Licence: MIT License
A Skinned Mesh Combiner that doesn't require actual skinned meshes as inputs

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to skinned-mesh-combiner

CodeProject
Common code for unity project develop.
Stars: ✭ 28 (-15.15%)
Mutual labels:  skinnedmesh
Mecanim2Texture
Bake skinned mesh animations to 2D textures
Stars: ✭ 45 (+36.36%)
Mutual labels:  skinnedmesh

Replaced with a faster version. Seriously, it's A LOT better.

skinned-mesh-combiner

Most skinned mesh combiners require actual SkinnedMeshComponents to base the data off of - this means it's a bit slower, since if you want to create a character with a lot of skinned mesh parts, you'll need to first create each individual skinned mesh renderer, then you'll need to merge them and destroy the old renderers.

This solution skips this issue - simply create a single rig, then give it a bunch of meshe datas - it then spits out a single SkinnedMeshComponent.

There are some downsides - by far the biggest one is the fact that each mesh being merged must have the same exact number of boneweights. So this solution is definitely not for everyone.

Usage

//Create Rig
GameObject rig = GameObject.Instantiate(myRig);

//Find the "packed" renderer, which has bone info
SkinnedMeshRenderer rigRenderer = rig.GetComponentInChildren<SkinnedMeshRenderer>();
Transform[] bones = rigRenderer.bones
Transform rootBone = rigRenderer.rootBone;

//Then build your array of SkinnedMeshDatas. These are the meshes / materials that you want to merge:

List<SkinnedMeshData> meshes = new List<SkinnedMeshData>();
meshes.Add(new SkinnedMeshData(mesh1,material));
meshes.Add(new SkinnedMeshData(mesh2,material));
meshes.Add(new SkinnedMeshData(mesh3,material));

//Pack! (In this case, by overwriting the already existing renderer)
Combine(rigRenderer,rootBone,bones,meshes)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].