0
$\begingroup$

I have a 3D model with a face shape keys that deforms the mouth/muzzle. What I'm trying to do is adding a new mesh (whiskers) into this existing face but have it deform along with the shapekeys. The new mesh does not have shapekeys yet. This model will be used in unity as a VRChat avatar. enter image description here

My goal is to join these meshes so that every shapekey in the original mesh also moves the new whiskers mesh. The following is what I hoped to see when i slide the shapekeys. enter image description here

I made that gif using a surface deform modifier on the whiskers, targeting the face mesh, then slide the shapekeys on the face mesh. the whiskers move with the face deformation. enter image description here

the big question is, how do i "apply" this surface deform modifier to the whiskers mesh and join it to the face mesh, and still have it deform when the face shapekeys are used? the end goal is to have a single mesh, with these shapekeys deforming the face and the whiskers mesh like how i see it with the surface deform.

i have a lot of shape keys and not too fond of the idea of joining the mesh, then individually move the whiskers in edit mode for every single shape key.

$\endgroup$

2 Answers 2

0
$\begingroup$

the big question is, how do i "apply" this surface deform modifier to the whiskers mesh and join it to the face mesh

  1. For every shapekey that affects the whiskers on "Bd" (the face, I presume):

    a) Pin that shapekey on Bd, so that it and it alone is exhibited at strength 1.0.

    b) On your whiskers object, click on the dropdown menu (downward pointing arrow button) and select "save as shapekey".

    c) Rename the shapekey that was just created by that "save as shapekey" operation to the same name as the currently pinned shapekey on Bd.

  2. Join your whiskers object to Bd.

$\endgroup$
2
  • $\begingroup$ this does exactly what i was looking for, thanks. is there a way to automate this process for, lets say, 50 shapekeys that affects the whiskers in the face mesh "Bd"? $\endgroup$ Dec 7, 2022 at 20:31
  • $\begingroup$ You could make a script for it, but I wouldn't be able to help you with that part of it. $\endgroup$
    – Nathan
    Dec 7, 2022 at 20:35
0
$\begingroup$

expanding on Nathan's answer, to do this programatically with a python script (since i have a buttload of shapekeys):

bpy.data.objects['Body'].show_only_shape_key = True  #enable pin shapekey on face
bpy.context.view_layer.objects.active = bpy.context.scene.objects["Whiskers"]  #set whiskers as active object; make sure it has only 1 shapekey (Basis)
for x in range(1,len(bpy.data.objects['Body'].data.shape_keys.key_blocks)):  #iterate through every shapekey except index 0 (Basis)
  bpy.data.objects['Body'].active_shape_key_index = x  #set active shapekey in body
  #
  bpy.ops.object.modifier_apply_as_shapekey(keep_modifier=True, modifier="MeshDeform")  #apply mesh deform to active object (wwhiskers)
  bpy.data.objects['Whiskers'].data.shape_keys.key_blocks[x].name = bpy.data.objects['Body'].data.shape_keys.key_blocks[x].name  #rename new shapekey to the same name as the one in body
bpy.data.objects['Body'].show_only_shape_key = False  #disable pin shapekey

and at the end of the journey, do number 2 of what Nathan said and join the objects

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .