Closed eddiehoyle closed 4 years ago
So the problem is basically that the VP2 subscene API makes the following assumption:
The problem is that when the instance becomes invisible, HD reports that there are no instances, which maya interprets as “please render as a single object”. The problem is here:
https://github.com/Autodesk/maya-usd/blob/dev/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp#L1493
Things I’ve tried:
I’ve attempted to use the MPxSubSceneOverride (via the drawScene variable) to removeAllInstances for the rprim. This sadly fails because when there are no instances, since VP2 has been treating it as a single object.
If there are no instances found, set the world matrix for the instance to ZERO (i.e. scale the instance out of existence). This actually works in the above repro, however since single objects in the usd scene also have no instance transforms, this stops them displaying.
I attempted to remove the render item from the override, however this doesn’t appear to be possible whilst in the middle of a scene update.
I’m currently seeing if I can remap from the rprim back to the prim, to see if I can differentiate between a normal prim and an instanced prim with no visible instances. I might then be able to scale it out of existence as a temporary work around.
@murphyeoin You mentioned trouble to prevent rendering of a single object and some tricks to prevent it from being rendered, like ZERO matrix. The typical way we achieve this is by disabling render items - see https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=Maya_SDK_MERGED_cpp_ref_class_m_h_w_render_1_1_m_render_item_html
@murphyeoin I believe the changes in https://github.com/Autodesk/maya-usd/pull/570 will fix this issue. Can you test to confirm?
Fantastic - thank you @williamkrick and @kxl-adsk - we will test right away!
Hi @williamkrick, confirming the changes in #570 fixed this. Thanks for your help!
Describe the bug Changing instanced prims visibility state to
"invisible"
isn't respected, draws prim at origin instead.Steps to reproduce
instanceable = True
and which references some imageable data.UsdGeom.Imageable
API, set the visibility attribute on the prim to"inherited"
or"invisible"
instanced = True
and visibility is set from"inherited"
to"invisible"
Here's a snippet:
Run these next blocks separately and repeatedly:
Apologies for the import pseudocode, I'm unfamiliar with the exact import commands
Expected behavior Visibility state of instanced prims should be respected by the viewport.
Attachments
Note: The locator represents world origin.
Specs (if applicable):