Home Website Youtube GitHub

Controlling Blendshape translation xyz seperatly

Axel Grossman that worked on God of War was talking about having multiple blendshape for a face but controlling the translation for each vert for different characters (human and ogre). Is there a way multiple values of certain verts? In Axel Grossman he mention it. At 37:18 https://vimeo.com/330507722

I don’t think it sounds like they are controlling each vert. Rather, it sounds like they take each blendshape, and then split the X, Y, and Z translation into 3 new separate blendshapes, so they can multiply each one independently.

“Is there a way”.

Unless someone wrote a plugin that did that, you’d have to do that with scripting. Extract the delta for each vertex, but then just write the x component to one shape, y to the next, z to the next. For each vertex: blendshapeTarget.x - baseMesh.x = newShape.x

It might be done with maps. Here’s a screen shot.

Maps can’t split the axes until you split them into separate blendshapes, unless you have a custom plugin which can expose that data. A map could certainly multiply the total blendshape(s). What exactly are you trying to do? The timestamp you gave was about splitting axes apart.

So what I’m doing is similar to what they were doing in God of War. I have a base mesh of a dog with multiple blendshapes and I want to transfer the blendshapes to multiple dog meshes. I have a large dog (Saint Bernard), medium dog (Poodle), and a small dog (Pug) with the same geomerty and same uvs. So the blendshapes have to multiple for the large dog and divide for the small. Is that possible? I want to make the blendshapes once for multiple characters.

here some code:

def splitXYZ(targets=None, basemesh=None):

#python translation of the splitXYZ script on highend3d
#https://www.highend3d.com/maya/script/batch-split-blendshape-mesh-to-xyz-for-maya

#generates meshes with seperated axis for a blendshape

#use: select first all of the targets, then the basemesh (or supply arguments)


if targets and basemesh:
    pm.select(targets, basemesh)

sel = pm.ls(sl=True)
size = len(sel)
if size <= 1:
    pm.mel.warning("Select the target meshes you need to split, then select the base mesh")

else:
    for i in range(0, size - 1):
        xObject = isolateAxis(sel[size - 1], sel[i], "x")
        yObject = isolateAxis(sel[size - 1], sel[i], "y")
        zObject = isolateAxis(sel[size - 1], sel[i], "z")

    return xObject, yObject, zObject

def isolateAxis(base, target, axis):

#function needed for splitXYZ
#:param base: the basemesh
#:param target: the targetmesh
#:param axis: axis on which to perform the isolation
#:return:

obj = pm.duplicate(target, n="{}_dup_{}".format(target, axis))[0]
numVerts = pm.polyEvaluate(base, v=1)
for i in range(numVerts):
    xform_base = pm.xform((base + ".vtx[" + str(i) + "]"),
                          q=1, t=1)
    xform_obj = pm.xform((str(obj) + ".vtx[" + str(i) + "]"),
                         q=1, t=1)
    xformDirection = {
        'yz': (xform_base[0], xform_obj[1], xform_obj[2]),
        'zy': (xform_base[0], xform_obj[1], xform_obj[2]),
        'xz': (xform_obj[0], xform_base[1], xform_obj[2]),
        'zx': (xform_obj[0], xform_base[1], xform_obj[2]),
        'xy': (xform_obj[0], xform_obj[1], xform_base[2]),
        'yx': (xform_obj[0], xform_obj[1], xform_base[2]),
        'z': (xform_base[0], xform_base[1], xform_obj[2]),
        'x': (xform_obj[0], xform_base[1], xform_base[2]),
        'y': (xform_base[0], xform_obj[1], xform_base[2]),
    }
    pm.xform((str(obj) + ".vtx[" + str(i) + "]"),
             t=xformDirection[axis])
return obj
1 Like