Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential crash when toggling shadows? #2

Open
pmolodo opened this issue Sep 7, 2018 · 2 comments
Open

Potential crash when toggling shadows? #2

pmolodo opened this issue Sep 7, 2018 · 2 comments

Comments

@pmolodo
Copy link
Contributor

pmolodo commented Sep 7, 2018

A bit back, I ran into a crash when toggling shadows.

I thought it was due to usage of invalid iterators, and made this PR, which seemed to fix it:

PixarAnimationStudios/OpenUSD#565

...however, on discussion with Pixar, realized the problem may be in our scene delegate. Need to remove this change to USD, then re-test to see if crash still exists, and if so, fix (possibly by adding check for double extract).

Original reproduction code was:

import maya.cmds as cmds
import maya.mel as mel

def loadPlug(plug):
    if not cmds.pluginInfo(plug, q=1, loaded=1):
        cmds.loadPlugin(plug)
loadPlug("AL_USDMayaPlugin")
#cmds.file('/Volumes/sv-dev01/devRepo/paulm/usd_samples/cube_proxy.ma', open=1, f=1)
cmds.file('/Volumes/sv-dev01/devRepo/paulm/usd_samples/Kitchen_set/Kitchen_set_proxy_camera.ma', open=1, f=1)


loadPlug("mtoh")
mel.eval('setRendererAndOverrideInModelPanel $gViewport2 hydraViewportOverride modelPanel4;')
light = cmds.createNode('spotLight')
lightXform = cmds.listRelatives(light, parent=1)[0]
cmds.setAttr("{}.tz".format(lightXform), 500)
cmds.setAttr("{}.useDepthMapShadows".format(light), 1)
@pmolodo
Copy link
Contributor Author

pmolodo commented Oct 9, 2018

Fixed here: d7b3f64

@pmolodo pmolodo closed this as completed Oct 9, 2018
@pmolodo
Copy link
Contributor Author

pmolodo commented Oct 11, 2018

This fix was a red herring - maybe I just got lucky the few times I tried this,
and it seemed to fix things. Real issue is that we are doing double extracts
from UsdImagingValueCache on transform and extent values; this happens because
HdMayaDelegateCtx::FitFrustumToRprims queries transform values to calculate a
good frustrum for it's shadow projection matrix; this means that
UsdImagingDelegate.GetTransform / GetExtent may be called both here, and when
rendering the transform itself.

However, it seems odd that you're not allowed to call GetTransform / GetExtent
more than once - especially since this is a publically exposed override of
HdSceneDelegate::GetTransform. Made a post on usd-interest here about this:

https://groups.google.com/forum/#!topic/usd-interest/tIEp5UyDpxs

Seems like the fix should be in usd itself, as there doesn't seem to be a "safe"
/ non-destructive way to get at this information currently...

@pmolodo pmolodo reopened this Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant