How To Blendshape Without Having To Move The Blendshapes Geo During Animation
Overview
This article covers how to create and implement blithe blendshapes in Maya.
Pic1: Models
This tutorial may rely on the GameSDK Sample Project. We recommend that you download this from the Nugget Database, import it into your Launcher, start it from at that place and so create a new level.
Come across this folio to find out how to import a project to your Launcher. (The default folder for the GameSDK Sample Project when downloaded is C:\Programme Files (x86)\Crytek\CRYENGINE Launcher\Crytek\gamesdk_<XXX>\GameSDK
)
Tutorial Files
Source Maya ASCII scenes with exported CRYENGINE files:
sdk_blendshape_maya_tutorial.zip (ii.9mb)(Extract this to the Avails folder in your GameSDK folder. See higher up for the default location of this folder.)
Setup Your Content In Maya
Requirements for the blendshape scene in Maya:
-
All blendshape meshes (exercise non delete them!) must exist in your Maya scene and should be in the same earth space location every bit the skinned base of operations mesh. And then, move your blendshape meshes on superlative of the skinned base mesh:
-
In some rare situations yous may have fix up your Maya as a Z-Up. If that is the case then for this tutorial you will need to reset it to a Y-Up. You must also ready your scene to 30 fps and to centimeter when it comes to exporting:
-
Yous must "smooth bind" at to the lowest degree one joint to the blendshape base mesh.
In the tutorial scene the base head mesh was bound to some common joints (meridian spine, neck, head, jaw, etc.).
The maximum influence count is eight. For performance's sake proceed it to four.
CPU/Software Skinning supports 8 weights per vertex and blendshapes.
GPU Skinning back up supports eight weights per vertex, but no blendshapes.
The top-level bound joint is "Spine04". Don't pare the "root" joint into your graphic symbol mesh - it is for CRYENGINE export:
-
Notice the empty "SceneRoot" group and "root" joint created for CRYENGINE orientation:
-
Make sure the root node of the skeleton bureaucracy has "zero" rotations - this means CRYENGINE interpretes information technology as Zero. Since CRYENGINE 3.8 and in respect to Maya in that location is a a properly orientated, empty "SceneRoot" group node and a "root" joint as the superlative-level node of the deforming skeleton. They take been setup with both looking forward with their Z-axes aligned to the World Y-centrality and the their Y-axes aligned to the World Z-axis:
-
For each blendshape mesh you must create a articulation in the origin and proper name it <BLENDSHAPE_MESH_NAME> + "_blendWeightVertex", e.thousand."sdk_player_head_brows_raise_blendWeightVertex". The "blendWeightVertex" joints accept been parented under the root joint for the skeleton hierarchy. (Employ the script below in step v!)
-
You must map the output range of the blendShape node weights from 0 to 1 to 0 to 100 of the translateX attribute of these joints. (Add an in-between MultiplyDivide node!)
-
Rather than manually creating the joints and connections yous may want to use the Python script below for the setup:
from maya import cmds def createBlendControlVertex(node, p=None, connect=True, debug=1): ''' Check outgoing "weight" connections of a blendShape node, create the appropriate blendWeightVertex joints. Optional: Connect and map the "weight" output range [0,1] of the blendShape node to [0,100] to the translateX attribute of these helper joints. Optional: Parent all blendWeightVertex joints nether a transform node ''' if debug: print node blendNodes=[] blendVertexJnts=[] endeavour: shapes = cmds.blendShape(node, t=1, q=1) shapeNode = cmds.listRelatives(node, children=ane, shapes=1) blendShapeNode = cmds.ls(cmds.listHistory(node),type='blendShape')[0] for shape in shapes: n = shape.split('mesh__')[-ane] + '_blendWeightVertex' if n not in blendVertexJnts: cmds.select(cl=1) jnt = cmds.joint(name=north) blendVertexJnts.append(jnt) blendNodes.append(jnt) if connect: endeavor: mult = cmds.shadingNode('multiplyDivide', asUtility=1, name = shape + '_MULT') cmds.connectAttr((blendShapeNode + '.' + shape.split('mesh__')[-1]), mult + '.input1.input1X') cmds.setAttr(mult + '.input2X', 100) cmds.connectAttr(mult + '.output.outputX', (due north + '.translateX')) except Exception as e: impress e except: print 'createBlendControlVertex>>>', node, 'has no blendshapes!' if p: if blendNodes: cmds.parent(blendNodes, p) return blendNodes
Paste the script into a Python script tab of Maya's Script Editor and execute it just once. Then run the script past the command.REMEMBER:If you decide to use another head mesh then don't forget to replace the"sdk_player_head":
createBlendControlVertex( 'sdk_player_head', p=None, connect=True, debug=1 )
You should parent those blendWeightVertex joints to the CRYENIGINE "root" articulation. Still, y'all can as well run the command (shown below) if the "root" joint has already been created:
createBlendControlVertex( 'sdk_player_head', p='root', connect=Truthful, debug=1 )
-
A dummy quad/triangle polymesh object must exist created and smooth skinned to a node of the skeleton hierarchy - it's best to select and include the top-about deforming influence as the but deforming joint.
Why do you need this dummy?Because this node only includes information virtually the skeleton hierarchy and thus keeps the model with skin and joint data separated from the skeleton. Hence, when you lot adhere a "pare attachment" in CRYENGINE'southward Character Tool both model + skinning data are separated from the bodily skeleton/joint (s) data. You could likewise attach the head mesh, so consecutively add more upper body apparel, etc.
-
Finally, y'all can add some blendshape animation. If you have blithe the blendshape node beforehand, and then you lot will notice the "blendWeightVertex" joints are moving when scrubbing the timeline.
Requirements before exporting to CRYENGINE: (applies to all character exports with ".SKIN" and *.CHR files)
-
A cryExportNode must be created for the skinned mesh with the BlendShape node. Utilize the "TOOLS" from Crytek shelf or create as shown in the screenshots below:
-
A second cryExportNode must be created for the skinned dummy quad/triangle mesh object:
-
In the cryExportNode of the skinned mesh with your blendshapes, prepare the consign file blazon as "*.Skin". Activate 8 Weights Per Vertex:
-
In the cryExportNode of the skinned dummy mesh, set the export file type as "*.CHR".
-
Add a proper material to the skinned blendshape mesh and mayhap a standard Phong material to the dummy object. Click the MAT.ED icon from the Crytek shelf to add a new material grouping, then add together the shaders you have created. A dx11Shader has been added for the "sdk_player_head" mesh and a standard Phong for all the residual. The dxShader will be used later for the wrinkle maps in the wrinkle map tutorial for CRYENGINE.
Exporting
-
Make sure you lot have saved the Maya scene (if you haven't already) before the next footstep. Printing the EXPORT icon in the Crytek shelf and export both cryExportNodes:
Pay special attention to/from what frame you export your "*.Skin" and "*.CHR" files. Rewind your Maya timeline to the frame where your demark pose is.
In our case nosotros bound the geometry to the skeleton in Frame 0.
-
In the Animation Consign tab add together a new animation for export. Type in a name for the animation (that will be displayed in CRYENGINE), plus the start and end frame positions. Then point the Exporter to the root node of the skinned character: this is the "root" joint in our case - yous may also want to manually add together the export binder (this should exist a sub-folder of
YOUR_PROJECT_FOLDER\Animations\...
).
Finally, press Consign all Anims.Note: Export Selected Anims will evidence upwardly if you take an animation selected!
The animation named "default" is the standard animation and will exist played automatically in the Sandbox Editor (i.eastward. when you lot add this character as "AnimObject" entity).
-
In that location are iv files you take exported: a *.CHR file, a *.SKIN file the intermediate animation *.I_CAF file and possibly the CRYENGINE *.MTL fabric file.
Now nosotros take successfully exported out our assets, it'south fourth dimension to move to the CRYENGINE portion of this tutorial.
Source: https://docs.cryengine.com/display/CEMANUAL/Tutorial+-+Animated+Blendshapes+-+Maya
Posted by: washingtonmorave.blogspot.com
0 Response to "How To Blendshape Without Having To Move The Blendshapes Geo During Animation"
Post a Comment