soupday / cc_blender_tools

Add-on for Blender, for importing and auto-setup of character creator 3 & 4 and iClone 7 & 8 character exports into Blender.
GNU General Public License v3.0
446 stars 80 forks source link

Bones are not correctly assigned in SkinnedMeshRenderers when exporting to Unity #111

Closed dastillero closed 1 year ago

dastillero commented 1 year ago

I have a case in which I import a character from CC4 to Blender and I separate arms and head in different objects. This a common scenario to create first person characters. When I export to Unity from Blender, the bones in the SkinnedMeshRenderers are always assigned to the root bone, which is incorrect. The main problem caused by this behaviour is that Unity will cull the separated objects during animations as the bounds of the objects will not move with the correct bones.

The issue can be reproduced by exporting a character to Unity from CC4 and comparing the resulting SkinnedMeshRenderers to the ones produced by exporting the same character from the Blender add-on.

As a workaround, the option "Always Animate" can be enabled for the Animator component. However, activating it has an effect on performance in Unity as the bound of each object have to be recalculated every frame.

Regards.

soupday commented 1 year ago

I've been trying to find out what's causing this for some time. But I never looked at the root bone of the skinned mesh renderer. Once you pointed that out, it's an easy fix. I'll set the root bones of each mesh object to the bone with the most overall weighting and recalculate the bounds around it.

Curious why the FBX exports from CC3/4 don't need the root bones correcting when the Blender exports do.