Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

The Evaluation Graph Bugs, notes, and other info

$
0
0
Maya 2016 introduced the Evaluation Graph.

Bugs:

The MPxNode.schedulingType method isn't supported in 2016 OpenMaya Python API

Issue
You can't do this, it's not supported:
    def schedulingType(self):
        return self.kParallel
Solution
Instead, you can do this:
def initializePlugin(mobject):
    # codez
    mc.setNodeTypeFlag("myPluginNodeType", threadSafe=True)
Note : After learning this, it may not matter: All since Python scripted plugins use.... Python, and Python itself isn't multi-threaded, they always, always evaluate in "globally serial" mode only. And should best be avoided in the EG.

TdeformerEvaluator Warnings in the Output Widow:

Issue: Tons of this stuff prints in the Output Window, slowing everything down during playback & batch operations. Example:
Warning: TdeformerEvaluator using dynamic mesh data source :polyColorPerVertex19 of type polyColorPerVertex, for final mesh :myMeshShape
Solution:
None yet, other than turning off 'GPU Override' disables all the spam.

GPU Override not working: Deformer 'not part of a chain'.

Issue: Using my NVidia Titan card, I couldn't get GPU Override to do anything, with VP2.0 turned on, not expressions in my scene, bacface culling disabled, etc. The HUD always says "Enabled (0k)". On a simple asset with mesh skinned to joints, when I run the Bonus Tools “GPU Acceleration Status: Check Common Deformers” on that scene, I get the below prints for all the deformers:
// Node skinCluster15 is supported but not a part of a chain.  Checking if related downstream nodes are supported. // 
Solution:
Based on the type of graphics card, GPU acceleration will only help with skinned mesh over a certain poly limit. Since we break our mesh up into many small parts, no one single part was over the threshold to actually start the optimization. From the docs, you need greater than 500 verts on AMD, and 2000 verts on NVidia cards to have any one mesh make use of optimization.
By combining all the small mesh into one large mesh and copying across the old weights, I saw a 1.5x speedup in framerate, and finally got the HUD to say "Enabled (17k)".
Here's an example of happy happy 'deformer chain':
// Deformer Chain: skinCluster1GroupParts.outputGeometry->:skinCluster1->:pCylinderShape1 // 

GPU Override not working: Backface Culling Fail:

Issue:
// Mesh :fooShape not supported by deformerEvaluator because backfaceCulling attribute is enabled. // 
Solution:
Turn off backface culling on all mesh in the scene:
import pymel.core as pm
map(lambda m: m.backfaceCulling.set(0), pm.ls(type='mesh'))

GPU Override not working: Group Component Fail:

Issue:
This was on a cluster node, not a skinCluster.
Cluster :cluster8 not supported by deformer evaluator since the group component is not complete.
Solution:
None yet...


Notes:

Notes below on its specifics, taken from Parallel_Evaluation_Maya2016.pdf.

Expressions

  • If your scene contains expression nodes that use the getAttr command the DG graph will be missing explicit dependencies, resulting in an incomplete EG. In addition to impacting correctness, expression nodes will also reduce the amount of parallelism in your scenes.
  • Maya currently defaults to scheduling expression nodes as 'untrusted' (see Thread Safety below).

Animation

  • When manipulating your rig, you may notice that performance improves once you’ve added at least 2 keys on a controller. By default, only animated nodes are included in the EG. This helps keep the EG compact, making it fast to build, schedule, and evaluate. Hence, if you’re manipulating a controller that hasn’t yet been keyed, Maya relies on legacy DG evaluation. When 2 or more keys are added, the EG is rebuilt to include the newly keyed nodes, permitting parallel evaluation via the EM.

Evaluation Modes:

Mode TypePurpose
DGUses the legacy Dependency Graph-based evaluation of your scene. This was the default evaluation mode prior to Maya 2016.
SerialEvaluation Manager Serial mode. Uses the EG but limits scheduling to a single core. Serial mode is a troubleshooting mode to pinpoint the source of evaluation errors.
ParallelEvaluation Manager Parallel mode. Uses the EG and schedules evaluation across all available cores. This mode is the new Maya 2016 default.
  • When using either Serial or Parallel EM modes, you can also activate the GPU Override, which accelerates deformations on your GPU. You must be in Viewport 2.0 to use this feature.
  • If you’ve enabled GPU Override and the HUD reports Enabled (0 k), this indicates that no deformations are happening on the GPU (which is probably weird\bad).

Evaluation Graph Correctness

  • In the event that you see evaluation errors, first try to test your scene in Serial evaluation mode. This eliminates threading as the possible source of differences.
  • If errors persist even after transitioning to Serial evaluation this indicates that the EM is building an incorrect EG for your scene.
  • Custom Plugins: If your scene uses custom plug-ins that rely on the MPxNode::setDependentsDirty function to manage attribute dirtying, this may be the source of problems.
  • Errors in Autodesk Nodes. Although we’ve done our best to ensure that all out-of-the-box Autodesk Maya nodes correctly express dependencies, it’s possible your scene is using nodes in an unexpected manner.

Thread Safety:

  • Developers working in Maya 2016 will need to update plug-ins to ensure correct behavior during multi-core evaluation. Although individual calls to nodes don’t need to be thread-safe (since we evaluate a node’s dirty plugs sequentially from a single thread), plugs values may be read concurrently once evaluated.
  • We’ve added new scheduling types that instruct the EM regarding how to schedule nodes. Scheduling types provide a straightforward migration path, so you don’t have to pass up opportunities for parallelizing some parts of your scenes, because a few nodes still need work.
Scheduling TypeWhat are you telling the scheduler?
ParallelAsserts that the node and that all third-party libraries used by the node are thread-safe.
SerialAsserts it is safe to run this node with instances of other nodes. However, all nodes with this scheduling type should be executed sequentially within the same evaluation chain.
GloballySerialAsserts it is safe to run this node with instances of other nodes but only a single instance of this node should be run at a time.
UntrustedAsserts this node is not thread-safe and that no other nodes should be evaluated while an instance of this node is evaluated
  • By default nodes are scheduled as Serial, which provides a middle ground between performance and stability/safety.
  • When testing your plug-ins with parallel Maya, a simple strategy is to schedule nodes with the most restrictive scheduling type (i.e., Untrusted), validate that the evaluation produces correct results, raise individual nodes to the next scheduling level, and repeat the experiment.
There are two ways to alter the scheduling level of your nodes:
1 : Mel/Python Commands:
evaluationManager -nodeTypeParallel on "transform"; // Parallel 
evaluationManager -nodeTypeSerialize on "transform"; // Serial
evaluationManager –nodeTypeGloballySerialize on “transform”; // GloballySerial 
evaluationManager -nodeTypeUntrusted on "transform"; // Untrusted
2 : C++/Python API methods:
Individual nodes can also be scheduled at compile time by overriding the MPxNode::schedulingType function. Functions should return one of the enumerated values specified by MPxNode::schedulingType. See the Maya 2016 MPxNode class reference for more details.

Safe Mode

On rare occasions you may notice that during manipulation or playback, Maya changes from Parallel to Serial evaluation. This is due to Safe Mode, which attempts to trap errors leading to instabilities, such as crashes. If Maya detects that multiple threads are attempting to simultaneously access a single node instance at the same time, the evaluation is forced to Serial execution to prevent problems.
You can manually set this:
// Disable the EM:
evaluationManager –mode “off”;
// Disable EM-accelerated manipulation
evaluationManager -man 0;
While Safe Mode catches many problems, it cannot catch them all. Therefore, we’ve also developed a special Analysis Mode that performs a more thorough and costly checks of your scene.

Custom Evaluators

Once the EG has been created, Maya can target evaluation of node sub-graphs. Currently it’s not possible for users to author new custom evaluators. In the future, we may extend OpenMaya to support such extensions.
Use the evaluator command to query the available evaluators and query or modify evaluators that are currently active.
import maya.cmds as cmds
# Returns a list of all evaluators currently available
cmds.evaluator( query=True )
# Result: [u'dynamics', u'pruneRoots', u’deformer’, u’cache’, u’null’] #

# Returns a list of all evaluators currently enabled.
cmds.evaluator( query=True, enable=True )
# Result: [u'dynamics', u'pruneRoots'] #

GPU Override

To accelerate deformations in Viewport 2.0, Maya 2016 contains a custom deformer evaluator that targets mesh deformations on the GPU using OpenCL.
We’ve included GPU implementations for 6 of the most commonly-used deformers in animated scenes:
  1. skinCluster
  2. blendShape
  3. cluster
  4. tweak
  5. groupParts
  6. softMod
Even if your scene uses only supported deformers, it’s possible the GPU override may not be enabled due to unsupported node features.
For example, with the exception of softMod, deformers must currently apply to all vertices and there is no support for incomplete group components.
Additional deformer specific limitations are listed below:
DeformerLimitation
skinClusterbindMethod basePoints bindPose bindVolume dropOff driverPoints envelope heatmapFalloff influenceColor lockWeights maintainMaxInfluences maxInfluences nurbsSamples paintWeights paintTrans smoothness useComponents weightDistribution weightList
blendShapebaseWeights baseOrigin icon inputTarget inputTargetGroup inputTargetItem targetWeights normalizationId normalizationGroup origin parallelBlender supportNegativeWeights targetOrigin topologyCheck useTargetCompWeights
clustern/a
tweakOnly relative mode is supported. relativeTweak must be set to 1.
groupPartsn/a
softModOnly volume falloff is supported when distance cache is disabled. Falloff must occur in all axes. Partial resolution must be disabled
There are a few other reasons that will prevent GPU override from accelerating your scene:
  • Meshes are not sufficiently dense.
    • For deformations to happen on the GPU, your mesh needs over 500/2000 vertices, on AMD/NVIDIA hardware respectively. You can change the threshold by using the MAYA_OPENCL_DEFORMER_MIN_VERTS environment variable.
  • Downstream nodes in your graph read deformed mesh results.
    • No node, script, or viewport can read the mesh data computed by the GPU override. This means that GPU override won’t be able to accelerate portions of the deformation chain upstream of nodes, such as follicle or pointOnPolyConstraint, as it requires information about the deformed mesh.
  • Meshes have animated topology changes.
    • If your scene animates the number of mesh edges, vertices, and/or faces during playback, corresponding deformation chains will be removed from the GPU deformation path.
  • Maya Catmull-Clark Smooth Mesh Preview is used.
    • We’ve included acceleration for OpenSubDiv (OSD)-based smooth mesh preview but there is currently no support for Maya’s legacy Catmull-Clark.
  • Unsupported streams are found
    • Depending on the drawing mode you’ve selected for your geometry (e.g., shrunken faces, hedge-hog normals, etc) and the material assigned to your geometry Maya will need to send different information to the graphics card
  • Back face culling is enabled
  • Driver-related issues.
To troubleshoot factors limiting use of GPU override for your particular scene, use the deformerEvaluator command.
deformerEvaluator; // For each selected node print the chain or a reason it is not supported
deformerEvaluator -chains;// Print all active deformation chains
deformerEvaluator -meshes; //Print a chain for each mesh or a reason it is not supported

Dynamics Evaluator

Maya 2016 has limited support for animated dynamics. Although scenes with Bullet rigid bodies and Bifrost fluids should evaluate correctly, attempting to playback or manipulate scenes with animated legacy (particles, fluids) or nucleus (nCloth, nHair, nParticles) nodes will disable the EM and revert to DG-based evaluation.

Viewing all articles
Browse latest Browse all 610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>