Character with multiple meshes will not export properly

Please bear with me I am rather new to Blender.
Using a few tutorials I found I created a character that has shape keys and a armature. While it would be great for the “entire” thing to be exported I am trying to use Collada (or Better Collada add on) as this will be going to Godot Game Engine.
Other models I have created with multiple meshes export fine all together when I select them during export, but for some reason the character will not export with the eyes attached or fully distorts the image. The only difference in the two my mesh’s that work have no animation, shape keys, etc. Its a basic mesh with texture.
I am guessing it is due to shape keys or other aspects, but no matter what kind of troubleshooting I do, the export chops it apart and makes it look horrible.
My Questions -

  • I have the main model on Layer 1, Armature Layer 2, and Eyes on Layer 3
  • To use the export I am only selecting the Model + Each Eye
  • I go to Export and choose Collada or Better Collada add on.
  • Options I make sure to choose only selected and triangulate. From there I have tested all sorts of other options, but I get random results when importing the mesh into a game engine.

Thoughts on how to fix it or do I need to combine meshes? It it shape keys messing up? Do I need to bake or apply something?




Picture 1 shows the model in wireframe mode.
Picture 2 shows it Rendered
Picture 3 shows how it comes up in Godot. I did 3 different types of exports and it ranged anywhere from just the model, the model with 1 eyeball randomly placed, or a completely destroyed model.

Please see the .blend file below.

<img src=“https://blend-exchange.giantcowfilms.com/embedImage.png?bid=4785” />

Here’s how you make a game character:
1: Model the character
2: Apply all modifiers (only armature modifier can stay)
4: Rig the character
3: Create shape keys
Mind the order, you can’t apply modifiers to meshes with shape keys, but you need to apply them because you can’t export modifiers from Blender.
By the way, this is a wrong subforum for this kind of stuff, it should be posted in somewhere like ‘Basics’ or ‘Animation and Rigging’.

Hey helluvamesh.

I appreciate the feedback and training. As I mentioned I am pretty new to the concept especially with the rig, shape keys, etc. Its my first ever character model outside of normal assets like barrels or other items.

So based on my model I would have to redo or get rid of the shape keys in order to apply the modifiers correct?

Also sorry about the wrong forum I tried to look over them last night and wasn’t sure which the right one was. :frowning:

Yep, developing games is full of these little surprises.

Great thank you! I really appreciate it.

Although, you can apply modifiers to a mesh with shape keys with python scripting:

  • make sure your armature is in rest pose and has all of its object transforms zeroed out
  • select mesh
  • run script from text editor

import bpy

scene = bpy.context.scene
obj = bpy.context.object
ori_obj = obj

# first one is base object
shape_key_objects = []

# create new objects from shape keys
if obj.data.shape_keys != None:
    for key_index, key_block in enumerate(obj.data.shape_keys.key_blocks):
        obj.active_shape_key_index = key_index
        obj.show_only_shape_key = True
        applied_mesh = obj.to_mesh(scene, apply_modifiers=True, settings='RENDER', calc_tessface=True, calc_undeformed=False)
        new_obj = bpy.data.objects.new (name=obj.name+'_'+key_block.name, object_data=applied_mesh)
        scene.objects.link (new_obj)
        shape_key_objects.append (new_obj)
        new_obj.show_only_shape_key = False

    obj.active_shape_key_index = 0

    # base objects: active, other shape key objects: selected
    bpy.ops.object.select_all (action='DESELECT')

    for obj in shape_key_objects:
        obj.select = True

    base_object = shape_key_objects[0]
    scene.objects.active = base_object
        
    # join selected objects into active object as shape keys
    bpy.ops.object.join_shapes ()

    # delete shape key objects (except for the first one)
    for index, obj in enumerate (shape_key_objects):
        if index != 0:
            scene.objects.unlink (obj)
            bpy.data.objects.remove (obj)
            
    # deal with groups and vertex weights:
    # copy original object
    if len (ori_obj.vertex_groups) &gt; 0:
        copy_obj = ori_obj.copy ()
        copy_obj.data = ori_obj.data
        scene.objects.link (copy_obj)

        for m in copy_obj.modifiers:
            if m.type != 'SUBSURF':
                copy_obj.modifiers.remove (m)
            
        copy_obj.parent = None

        # active: original object copy
        bpy.ops.object.select_all (action='DESELECT')
        copy_obj.select = True
        base_object.select = True
        scene.objects.active = base_object

        bpy.ops.object.mode_set (mode='WEIGHT_PAINT')
        bpy.ops.object.data_transfer (use_reverse_transfer=True, data_type='VGROUP_WEIGHTS', vert_mapping='POLYINTERP_NEAREST', layers_select_src='NAME', layers_select_dst='ALL')

        bpy.ops.object.mode_set (mode='OBJECT')
        # delete copy object
        scene.objects.unlink (copy_obj)
        bpy.data.objects.remove (copy_obj)

Oh wow that’s awesome it did indeed apply my modifiers while keeping shape keys. You rock! My object will still not export properly sadly so I am sure I messed something up some where in the rigging or exporting in general. Learn learn learn :wink:

  • Do not animate objects attached to the armature, only animate the armature
  • apply all transforms to the objects
  • with this character whats the point of having multiple meshes - just merge them into the main mesh - best for performance anyways
  • make sure a vertex is only affacted by at most 4 bones: Weight Paint Mode > Limit Total > 4
  • normalize weights: Weight Paint Mode > Normalize All
  • the root bone’s rest pose should be at (0, 0, 0)

Thanks ill give that a try tonight. This is the only character in my game so if I can get him to export correct I am golden for moving forward with the entire thing.

I may have to give you credits in my game for helping me getting to going if it works! :slight_smile:

1 Like