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

always register and de-register the PxrMayaHdImagingShape and its draw override #810

Conversation

mattyjams
Copy link
Contributor

While the USD proxy shape classes included in the maya-usd repo all use either the (legacy) Pixar batch renderer or the Viewport 2.0 render delegate, there may be other custom node types that may or may not leverage USD but still want to take advantage of aggregated drawing using Hydra.

As an example, internally at Pixar we have a custom Maya shape node that is a severely stripped down approximation of a UsdGeomPointInstancer. This shape maintains its own data structures as a mix of USD and non-USD data, but it still uses the PxrMayaHdImagingShape and the Pixar batch renderer for drawing. I'm not sure whether other studios have custom shape nodes that leverage the Pixar batch renderer and its shape adapter system in this way, but it was definitely written with the intention of supporting that.

In our case, the eventual goal is that once we've fully transitioned to the Viewport 2.0 render delegate and UFE, we'll be authoring UsdGeomPointInstancer prims directly under a mayaUsdProxyShape and will no longer need this custom node type. As a result, we don't see value putting effort into making the custom shape work with the Viewport 2.0 render delegate. Instead, we're hoping that it can continue to use the Pixar batch renderer as we transition, and then we'll retire the shape once we've switched.

I don't think there should be any ill effects from always registering and de-registering PxrMayaHdImagingShape and its draw override. If no nodes are created in the scene that call PxrMayaHdImagingShape::GetOrCreateInstance() in their postConstructor() override, we shouldn't see any imaging nodes created and the Pixar batch renderer shouldn't get instantiated either.

…w override

While the USD proxy shape classes included in the maya-usd repo all use either
the (legacy) Pixar batch renderer *or* the Viewport 2.0 render delegate,
there may be other custom node types that may or may not leverage USD but still
want to take advantage of aggregated drawing using Hydra.

This change decouples the registration and de-registration of the
PxrMayaHdImagingShape and its draw override from whether the Viewport 2.0
render delegate is enabled for proxies and instead does it unconditionally.
Shapes that use PxrMayaHdImagingShape must call its GetOrCreateInstance() in
their postConstructor() override in order to get setup for drawing.
@mattyjams
Copy link
Contributor Author

To put it another way, right now enabling the Viewport 2.0 render delegate for USD proxy shape node types effectively disables the Pixar batch renderer for all shape node types, not just USD proxies. We'd like to still be able to use the batch renderer for non-proxy shape types to smooth the transition.

@kxl-adsk kxl-adsk added legacy rendering Related to draw override rendering proxy Related to base proxy shape labels Oct 1, 2020
@huidong-chen
Copy link

I am not familiar with the PxrMayaHdImagingShape class. If we enable the congregated draw for this node type, will it introduce duplicated drawing for the same objects from both VP2RenderDelegate and the draw override you enable in this commit?

@mattyjams
Copy link
Contributor Author

I am not familiar with the PxrMayaHdImagingShape class. If we enable the congregated draw for this node type, will it introduce duplicated drawing for the same objects from both VP2RenderDelegate and the draw override you enable in this commit?

@HdC-adsk: Good question. No, we should be ok there. We effectively have two layers of protection against that.

The proxy shape classes guard against even creating an instance of the PxrMayaHdImagingShape when we're using the Viewport 2.0 render delegate:

if (!MayaUsdProxyShapePlugin::useVP2_NativeUSD_Rendering())

if (!MayaUsdProxyShapePlugin::useVP2_NativeUSD_Rendering())

So if none of these custom node types are in play, we really shouldn't end up with a PxrMayaHdImagingShape node in the scene when the Viewport 2.0 render delegate is enabled.

Even if we do have a PxrMayaHdImagingShape node in the scene, we're still not registering the legacy Pixar batch renderer UsdMayaProxyDrawOverride for proxy shapes when the Viewport 2.0 render delegate is enabled, so no proxy shape rprims would get populated in the batch renderer, and there would be nothing for it to draw.

@huidong-chen
Copy link

No worry about the preflight build errors. They are relevant to a new API class we recently added and will fix it soon.

@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 2, 2020
@kxl-adsk kxl-adsk merged commit 0f34456 into Autodesk:dev Oct 2, 2020
@mattyjams mattyjams deleted the pr/always_register_deregister_PxrMayaHdImagingShape branch October 2, 2020 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy rendering Related to draw override rendering proxy Related to base proxy shape ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants