banner



Do Blendshapes Require Mesh In Animation File?

Overview

This article covers how to create and implement animated blendshapes from Maya into CRYENGINE.


Tutorial Files

Source Maya ASCII scenes with exported CRYENGINE files:

sdk_blendshape_tutorial.zippo ( 2.9mb )

(Do think that you even so need to have a modified "SkeletonList.xml" where you have added the skeleton CHR of this tutorial. Simply in example you want to skip all these steps and desire to open the character in CE Graphic symbol Tool: SkeletonList.zip )

Backup your "SkeletonList.xml" earlier overwriting it!

Setup Your Content In Maya

Requirements for the blendshape scene in Maya:

  1. All blendshape meshes (do not delete them!) must be in your Maya scene and should be in the same world infinite location every bit the skinned base mesh. So, motility your blendshape meshes on elevation of the skinned base of operations mesh:

  2. In some rare situations you may take setup your Maya every bit a Z-Upwardly. If that is the case and so for this tutorial you volition demand to reset information technology to a Y-Up. You must too fix your scene to 30FPS and to "centimeters" when it comes to exporting:


  3. You must "smoothen demark" at to the lowest degree one joint to the blendshape base of operations mesh!

    In the tutorial scene the base head mesh was leap to a some common joints (top spine, neck, head, jaw, etc.).

    Go on the maximum influence count to eight! For performance sake keep it to four.

    CPU/Software Skinning supports eight weights per vertex and blendshapes.

    GPU Skinning support supports 8 weights per vertex, but no blendshapes.

    The acme-level bound joint is "Spine04". Don't skin the "root" joint into your grapheme mesh - it is for CRYENGINE export:


  4. Notice the empty "SceneRoot" group and "root" joint created for CRYENGINE orientation:



  5. Brand certain the root node of the skeleton hierarchy has "null" rotations - this means CRYENGINE interpretes information technology every bit 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" articulation as the pinnacle-level node of the deforming skeleton. They take been setup with both looking frontwards with their Z-axes aligned to the World Y-axis and the their Y-axes aligned to the World Z-axis:


  6. For each blendshape mesh you must create a joint in the origin and name information technology <BLENDSHAPE_MESH_NAME> + "_blendWeightVertex", e.yard. "sdk_player_head_brows_raise_blendWeightVertex". The "blendWeightVertex" joints take been parented under the root joint for the skeleton bureaucracy. (Apply the script beneath in step 5!)

  7. You must map the output range of the blendShape node weights from 0 to one to 0 to 100 of the translateX aspect of these joints. (Add together an inbetween multiplyDivide node!)

  8. Rather than manually creating the joints and connections you may want to use the Python script below for the setup:

    from maya import cmds  def createBlendControlVertex(node, p=None, connect=True, debug=i):     '''     Check approachable "weight" connections of a blendShape node, create the advisable 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 under a transform node     '''     if debug: print node     blendNodes=[]     blendVertexJnts=[]     endeavour:         shapes = cmds.blendShape(node, t=i, q=1)         shapeNode = cmds.listRelatives(node, children=1, shapes=1)         blendShapeNode = cmds.ls(cmds.listHistory(node),type='blendShape')[0]         for shape in shapes:             n = shape.split('mesh__')[-1] + '_blendWeightVertex'             if n not in blendVertexJnts:                 cmds.select(cl=i)                 jnt = cmds.joint(proper name=n)                 blendVertexJnts.append(jnt)                 blendNodes.append(jnt)             if connect:                 try:                     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', (n + '.translateX'))                 except Exception as eastward:                     print 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'south Script Editor and execute it just in one case. So run the script past the command. REMEMBER: If you determine to utilize 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" joint. However, y'all can also run the command (shown below) if the "root" joint has already been created:

    createBlendControlVertex( 'sdk_player_head', p='root', connect=Truthful, debug=1 )

  9. A dummy quad/triangle polymesh object must be created and smooth skinned to a node of the skeleton hierarchy - it'south all-time to select and include the summit-most deforming influence every bit the only deforming joint.

    Why do you need this dummy? Because this node only includes information about the skeleton hierarchy and thus keeps the model with skin and joint data separated from the skeleton. Hence, when y'all attach a "peel zipper" in CRYENGINE's Character Tool both model + skinning data are separated from the actual skeleton/joint (s) data. You could also attach the head mesh, so consecutively add more upper body apparel, etc.

  10. Finally, yous tin can add some blendshape animation. If you take animated the blendshape node beforehand, then you lot volition observe the "blendWeightVertex" joints are moving when scrubbing the timeline.

Requirements before exporting to CRYENGINE: (applies to all grapheme exports with ".SKIN" and *.CHR files)

  1. A cryExportNode must be created for the skinned mesh with the blendShape node. Use the "TOOLS" from crytek shelf or create as shown in the screenshots below:

  2. A 2nd cryExportNode must be created for the skinned dummy quad/triangle mesh object:

  3. In the cryExportNode of the skinned mesh with your blendshapes, set up the export file blazon as "*.Skin". Activate "Eight Weights Per Vertex":

  4. In the cryExportNode of the skinned dummy mesh,ready the consign file type as "*.CHR".

  5. Add a proper textile to the skinned blendshape mesh and perhaps a standard Phong material to the dummy object. Click the "MAT.ED" icon from crytek shelf to add a new cloth group, then add the shaders you have created. A dx11Shader has been added for the "sdk_player_head" mesh and a standard Phong for all the rest. The dxShader will exist used later for the wrinkle maps in the wrinkle map tutorial for CRYENGINE.

  6. Brand sure you have saved the Maya scene (if you haven't already) before the next step. Press the "Export" icon in crytek shelf and export both cryExportNodes:

    Pay special attending to/from what frame yous export your "*.Pare" and "*.CHR" files! Rewind your Maya timeline to the frame where your bind pose is!

    In our example nosotros bound the geometry to the skeleton in Frame 0.

  7. In the "Animation Export" tab add a new animation for consign.Type in a name for the animation (that will be displayed in CRYENGINE), plus the starting time and end frame positions. Then point the Exporter to the root node of the skinned grapheme: this is the "root" articulation in our instance - you lot may also want to manually add the export folder (this should be a sub-folder of "CRYENGINE_ROOT_FOLDER>\GameSDK\Animations\...").
    Finally, press "Consign all Anims".

    Note:  "Consign Selected Anims" will show up if  you have an animation selected!

    The blitheness named "default" is the standard animation and will be played automatically in the Sandbox Editor (i.e. when you add together this character as "AnimObject" entity).

  8. In that location are 4 files you have exported: a *.CHR file, a *.Pare file the intermediate animation *.I_CAF file and possibly the CRYENGINE *.MTL material file.

Setup Your Content In CRYENGINE

This section explains how to add together a new character to CRYENGINE using the Graphic symbol Tool.

  1. Open up the Sandbox Editor from your CRYENGINE folder, this will be located somewhere in: "\Bin64\Editor.exe". Open the Grapheme Tool:

  2. The screenshot below shows the left pane split into two vertical layouts, this is activated using the icon highlighted by the carmine arrow and provides two viewing filters. You might want to prepare the lower pane to the filter "Blitheness" in the course of this tutorial.

  3. First add the new skeleton to the SkeletonList:

  4.  At the bottom of the list, browse for the *.CHR file you take exported from Maya and requite it a name. Press the save icon to salve the SkeletonList.xml. You should notice the asterisk volition go abroad ( "*Skeleton Listing" becomes "Skeleton Listing" over again ).

  5. Create a new *.CDF file and give the CRYENGINE grapheme a nice name:

  6. Assign your exported skeleton ".CHR" file in the skeleton section. The yellow warn boxes will assistance y'all fix what is missing to become a right CRYENGINE character.

  7. Add a peel attachment to the skeleton *.CHR file.


  8. By default the Character Tool will add a "Joint Attachment", alter this to a "Skin Zipper" and browse for the *.CHR file you have exported earlier.


  9. This will be the electric current configuration of the character. Now assign the fabric you have exported. We volition fix the black shaded fabric for the head in the last step. This is considering we assigned it a dx11Shader in Maya, which CRYENGINE doesn't back up.

    Activate the "Software Skinning" option for the blendshapes to work!


  10. The Character Tool is missing the location of the animations (and more). A *.CHRPARAMS file will handle this. To create a new *.CHRPARAMS for this character, click on the Skeleton field - this is the expanse marked in red (screenshot to a higher place) and that is loaded with the *.CHR.

  11. Add an "Animation Set Filter" and point to the directory of your exported "default.i_caf" blitheness file! The *.I_CAF file is an intermediate format before pinch. If you wish, y'all tin can add a new "Animation Events" after this step to get rid of the yellowish alarm box - but select the animation folder of the *.I_CAF.

  12. Browse the directory containing the *.I_CAF file(due south):

  13. On the left you volition find the associated animations with the skeleton *.CHR.

  14. Select the "default" animation from the left pane. You now need to add together a new *.ANIMSETTINGS file and save it:

  15. In order for the the Character Tool to update your blendshape animation go to the left pane - switch by double-clicking LMB on whatsoever existing *.CDF and then get dorsum to this tutorial's *.CDF that yous created. (Yous might demand to exit and restart the Sandbox Editor and so go back to the Character Tool).

  16. Scan the left pane for the saved grapheme (sdk_blendshape_tutorial.cdf ). Select and double-click "default" animation from the bottom left (or press spacebar). You should see both the skeletal animation of the caput/cervix joint AND the blendshape animation playing besides:

    Tip: Cheque for the red marked areas (screenshot above). The options identified will help you inspect the scene you accept created.

  17. You may besides want to correct the "sdk_player_head" material. Open up the Material Editor from the Sandbox Editor and edit the textile to something more useful. TheCharacter Tool window will update the changes made:

Summary

To conclude this tutorial, here is a list of the files you lot created in Maya and exported to CRYENGINE:(supercede the file name if yous chose to use dissimilar names):

  • saved your Maya scene file as a Maya ASCII file before export
  • exported a *.Skin file: sdk_player_head.peel containing the model with skeleton and skinning data
  • exported a *.CHR file: sdk_player_head_skel.chr containing the skeleton bureaucracy
  • *.CHR and *.Pare requires you lot to consign from the bind/dag pose frame
  • exported a*.I_CAF file:default.i_caf containing the animation information
  • exported a *.MTL file: sdk_player_head.mtl containing the CE material info


In the CRYENGINE Character Tool you edited/created the following files (either past yourself or automatically by the CRYENGINE Character Tool):

  • In the default SkeletonList.xmlin "<CRYENGINE_ROOT_FOLDER>\GameSDK\Animations" folder you lot added your new skeleton
  • created a*.CDF file: sdk_player_head_blendshape_tutorial.cdf which defines the animated CRYENGINE character
  • created a*.CHRPARAMS file:sdk_player_head_skel.chrparams containing the location of the related animation .i_caf/.caf files
  • created a *.ANIMSETTINGS file: default.animsettings containing the compression ratio for your blitheness

As a follow-up to this blendshape tutorial nosotros volition continue with a wrinkle map setup which will add more particular: Wrinkle Maps Tutorial

More advanced information regarding blendshape animation inside CRYENGINE can be plant beneath - these are mostly used for debugging purposes.

Engine CVars

General CVars:

  • ca_vaBlendEnable 1/0 - general CVar to enable/disable blend shapes on CPU.default: i
  • ca_vaEnable 1/0 - general CVar to enable/disable all CPU based vertex animation (including linear skinning on CPU).default: one
  • ca_vaScaleFactor 1 - a multiplier scalar applied on peak of the deltas.default: one
  • ca_vaProfile 0/one - displays information near the electric current blend vertices.default: 0

Blend Alternative CVars:

  • ca_vaBlendCullingThreshold - the higher the number and then the more alloy shapes will be culled (based on how many pixels they cover).default: i.0
  • ca_vaBlendCullingDebug 0/ane - set to 1 to prove the divergence between 'with' and 'without' blend culling (by toggling the characteristic every other frame). default: 0
  • ca_vaBlendPostSkinning 0/1 - perform vertex animation blends post skinning (instead of pre-skinning). default: 0

Tangent Updates

Not-rigid deformation requires tangent updates in lodge to obtain the correct shading. Geometric real-fourth dimension tangent updates are expensive, so in order to minimize CPU cost we use vertex colors to transfer a blue (0,0,255) painted mask inside Maya that marks the about important facial parts. The budget for XBox One was ~2K vertices.

Tangent updates but piece of work with 8 weights skinning and software skinning (Flags=eight) in the .cdf file.

To enable/disable/preview the triangles marked past the mask in the ENGINE use the following CVars:

  • ca_vaUpdateTangents 0/ane
  • ca_debugSWSkinning 3 (to display the triangles that get updated)

Source: https://docs.cryengine.com/display/SDKDOC2/Animated+Blendshapes+Tutorial

Posted by: vasquezsubmis.blogspot.com

0 Response to "Do Blendshapes Require Mesh In Animation File?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel