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

Hard crashes while running 'ogsRender' command with proxyShapes #3415

Open
jufrantz opened this issue Oct 25, 2023 · 5 comments
Open

Hard crashes while running 'ogsRender' command with proxyShapes #3415

jufrantz opened this issue Oct 25, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jufrantz
Copy link
Contributor

Describe the bug

We get hard crashes in some scenarios while running ogsRender command. We noticed it happens when the proxyShape's stage contains instances. It also manifests when working with display layers that have USD memberships. I am joining two reproductions even if the underlying cause is likely the same.

Steps to reproduce

ogsRender and instances
  1. Create a mayaUsd proxyShape with some instances
import maya.cmds
import mayaUsd.ufe
import mayaUsd_createStageWithNewLayer
maya.cmds.loadPlugin("mayaUsdPlugin", quiet=True)

proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
mayaUsd.ufe.getStage(proxyShape).GetRootLayer().ImportFromString('''#sdf 1
def Scope "Proto"
{
    def Sphere "Geo" 
    {
    }
}
def "Inst_1" (
    instanceable = True
    references = </Proto>
)
{
}
def "Inst_2" (
    instanceable = True
    references = </Proto>
)
{
}
''')
  1. Execute a non-viewport VP2 render, e.g. by calling ogsRender
maya.cmds.ogsRender()
  1. It should crash, we get this stack trace:
Autodesk::Maya::OpenMaya20230000::MHWRender::MFrameContext::applyViewTransform(Autodesk::Maya::OpenMaya20230000::MColor const&, Autodesk::Maya::OpenMaya20230000::MHWRender::MFrameContext::Direction) const
pxrInternal_v0_22__pxrReserved__::ProxyRenderDelegate::_GetDisplayColor(std::pair<Autodesk::Maya::OpenMaya20230000::MColor, std::atomic<unsigned long> >&, char const*, bool, Autodesk::Maya::OpenMaya20230000::MColor const&)
pxrInternal_v0_22__pxrReserved__::ProxyRenderDelegate::GetTemplateColor(bool)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::_UpdateDrawItem(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::HdVP2DrawItem*, pxrInternal_v0_22__pxrReserved__::HdVP2DrawItem::RenderItemData&, pxrInternal_v0_22__pxrReserved__::HdMeshReprDesc const&, pxrInternal_v0_22__pxrReserved__::TfToken const&)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::_UpdateRepr(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::TfToken const&)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::Sync(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::HdRenderParam*, unsigned int*, pxrInternal_v0_22__pxrReserved__::TfToken const&)
...
ogsRender and displayLayer
  1. Create a mayaUsd proxyShape with a simple stage
import maya.cmds
import pxr.UsdGeom
import mayaUsd.ufe
import mayaUsd_createStageWithNewLayer
maya.cmds.loadPlugin("mayaUsdPlugin", quiet=True)

proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
pxr.UsdGeom.Sphere.Define(mayaUsd.ufe.getStage(proxyShape), "/Sphere")
  1. Create a displayLayer containing /Sphere with template display style
maya.cmds.select(f"{proxyShape},/Sphere")
displayLayer = maya.cmds.createDisplayLayer()
maya.cmds.setAttr(f"{displayLayer}.displayType", 1)
  1. Call ogsRender
maya.cmds.ogsRender()
  1. It should crash, we get a similar stack trace:
Autodesk::Maya::OpenMaya20230000::MHWRender::MFrameContext::applyViewTransform(Autodesk::Maya::OpenMaya20230000::MColor const&, Autodesk::Maya::OpenMaya20230000::MHWRender::MFrameContext::Direction) const
pxrInternal_v0_22__pxrReserved__::ProxyRenderDelegate::_GetDisplayColor(std::pair<Autodesk::Maya::OpenMaya20230000::MColor, std::atomic<unsigned long> >&, char const*, bool, Autodesk::Maya::OpenMaya20230000::MColor const&)
pxrInternal_v0_22__pxrReserved__::ProxyRenderDelegate::GetTemplateColor(bool)
pxrInternal_v0_22__pxrReserved__::MayaUsdRPrim::_GetHighlightColor(pxrInternal_v0_22__pxrReserved__::TfToken const&, pxrInternal_v0_22__pxrReserved__::HdVP2SelectionStatus)
pxrInternal_v0_22__pxrReserved__::MayaUsdRPrim::_GetHighlightColor(pxrInternal_v0_22__pxrReserved__::TfToken const&)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::_UpdateDrawItem(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::HdVP2DrawItem*, pxrInternal_v0_22__pxrReserved__::HdVP2DrawItem::RenderItemData&, pxrInternal_v0_22__pxrReserved__::HdMeshReprDesc const&, pxrInternal_v0_22__pxrReserved__::TfToken const&)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::_UpdateRepr(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::TfToken const&)
pxrInternal_v0_22__pxrReserved__::HdVP2Mesh::Sync(pxrInternal_v0_22__pxrReserved__::HdSceneDelegate*, pxrInternal_v0_22__pxrReserved__::HdRenderParam*, unsigned int*, pxrInternal_v0_22__pxrReserved__::TfToken const&)
...

Specs (if applicable):

  • CentOS 7.8
  • Maya 2023.3
  • maya-usd 0.25
  • USD 22.11
@jufrantz jufrantz added the bug Something isn't working label Oct 25, 2023
@neilh-adsk neilh-adsk moved this to Needs triage in maya-usd Nov 6, 2023
@Autodesk Autodesk deleted a comment from maya-usd-git-sync bot Mar 5, 2024
@pierrebai-adsk
Copy link
Collaborator

Here is a temporary work-around: run the following MEL command (or equivalent in Python) before ogsRender:

colorManagementPrefs -e -outputTransformEnabled 1 -outputTarget "renderer";

@jufrantz
Copy link
Contributor Author

Thank you @pierrebai-adsk,

I gave it a try, but the workaround appears to be effective only when color management is turned on. Unfortunatly in our case it happens in un-color-managed scenes.

Could this be a bug in the OpenMaya sdk ? If so, I might submit a report on Maya's support platform.

@pierrebai-adsk
Copy link
Collaborator

pierrebai-adsk commented Mar 18, 2024

It is a bug in the Maya SDK. I fixed it, but it will be only available in a future release and I cannot vouch which Maya version will have it or not. I'm no color management expert, IDK if there would be a way to create a "pass-through" color correction that would not affect the color when applied.

@jufrantz
Copy link
Contributor Author

Ok great. Would you be able to share the ID for the maya fix?
Thanks

@pierrebai-adsk
Copy link
Collaborator

It was tracked internally as EMSUSD-1083.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage
Status: Needs triage
Development

No branches or pull requests

3 participants