PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.11k stars 1.21k forks source link

Add empty sublayer will invalidate the 3 attribute queries in UsdSkelAnimQuery #1500

Closed frankzhang11 closed 3 years ago

frankzhang11 commented 3 years ago

Description of Issue

Add empty sublayer will invalidate the 3 attribute queries in UsdSkelAnimQuery. LayerStack in resolveinfo is not updated.

Steps to Reproduce

sublayer_resync.zip 1 decompress this zip file. The folder "UsdSkelExamples" is almost empty (it is too big and unneccesary to upload), put pixar UsdSkelExample here.

  1. use usdview to run with the Scene.usda, which is an empty scene as rootlayer.
  2. run the first part of Script_PixarUsdSkelExample.py in interpreter to load the "HumanFemale.walk.usd" as sublayer. You'll see the animation plays well. 4 run the second part of Script_PixarUsdSkelExample.py in interpreter to load the "Empty.usda" as sublayer. The animation will be broken.

System Information (OS, Hardware)

Win10 (doesn't matter)

Package Versions

21.05 and before.

Build Flags

We actually have some debug on the reason. It is because this line.
https://github.com/PixarAnimationStudios/USD/blob/2b38362e4a0d93d4741ca4dd89cbdb9e59f2abcd/pxr/usd/pcp/changes.cpp#L1794 If the sublayer is empty, this line will stop the scene from doing a full resync. which makes the 3 attributeQuery in UsdSkelAnimQuery(implementation) invalid. https://github.com/PixarAnimationStudios/USD/blob/dev/pxr/usd/usdSkel/animQueryImpl.cpp#L99

The easy fix is to remove the !sublayer->IsEmpty() check, and full scene can be retriggered (this behavior is the same as you add a scene with any prim(s) as sublayer). And skelAnimationQuery will be normal.

I understand that add a layer literally should resync the full scene since any data might change, but add a sublayer means that only attribute layerstack might change, it will be expensive to resync the whole scene, only the layerstack update is required. I wonder if Pixar already have any ideas for sparsely invalidating/updating the attributeQuery in usdimaging, especailly for UsdSkelImaging? Thanks.

jtran56 commented 3 years ago

Filed as internal issue #USD-6664

spiffmon commented 3 years ago

Thanks, @onamiforest , we're having a look. The line you identified in Pcp was an explicit optimization added in response to performance concerns in Solaris; however, we hadn't realized it would invalidate UsdAttributeQuery objects.