wrap.computeBlendShape

wrap.computeBlendShape(neutralGeom, targetGeoms, targetWeights, neutralTexture = [], targetTextures = [])

Compute blendshape with specific weights.

Parameters:

neutralGeom : wrap.Geom

Neutral geometry

targetGeoms : list of wrap.Geom

List of target geometries. Number of vertices of each target must match to the number of vertices of neutral geometry.

targetWeigths : list of float

List of target weights represented as floats.

neutralTexture : wrap.Image

Texture of neutral geometry

targetTextures : list of wrap.Image

List of target textures. Format and dimensions of each target texture must match to neutral texture.

Returns:

result : wrap.Matrix4x4

Returns matrix 4x4 that will transform geomFloating to geomFixed.

Examples

To compute blendshape with textures interpolated:

# specify names and weights
neutralGeomFilename = 'Neutral.obj'
neutralTextureFilename = 'Neutral.jpg'
targetGeomFilenames = ['Fear.obj','Pain.obj','Smile.obj']
targetTextureFilenames = ['Fear.jpg','Pain.jpg','Smile.jpg']
targetWeights = [0.14, 0.61, 0.87]

# loading models
neutralGeom = wrap.Geom(wrap.demoModelsPath + '/Blendshapes/' + neutralGeomFilename)
neutralGeom.texture = wrap.Image(wrap.demoModelsPath + '/Blendshapes/' + neutralTextureFilename)
targetGeoms = [ wrap.Geom(wrap.demoModelsPath + '/Blendshapes/' + filename) for filename in targetGeomFilenames ]
targetTextures = [ wrap.Image(wrap.demoModelsPath + '/Blendshapes/' + filename) for filename in targetTextureFilenames ]

# hiding neutral and target geoms to make visible only blendshape
neutralGeom.hide()
for targetGeom in targetGeoms: targetGeom.hide()

# computing blendshape
blendshapeGeom = wrap.computeBlendShape(neutralGeom, targetGeoms, targetWeights, neutralGeom.texture, targetTextures)

And if you need only geometry without textures just not pass texture parameters:

# computing blendshape
blendshapeGeom = wrap.computeBlendShape(neutralGeom, targetGeoms, targetWeights)