Missing mapping for RenderTags from usdtokens to hydratokens

Hello,

We have encountered an issue when a HdPurposeSchema schema is defined and set to “default”, Hydra skips rendering objects with those tags.

The problem seems to be the way HdSceneIndexAdapterSceneDelegate(HdSIASD) is handling the render tags. There needs to be a mapping from usdtokens to hydratokens.

For ex: in usdview, there is a mapping that maps usdtoken “default” to hydratoken “geometry” in GetRenderTag() of the usdview scene delegate.

However, HdSIASD 's GetRenderTag() is not doing this mapping causing Hydra to receive an unrecognized token. It works for the case when no purpose tag is specified.

if (!purposeSchema.IsDefined())
{
return HdRenderTagTokens->geometry; // default render tag.
}

But when a “default” tag is defined in the USD Stage, the current logic fails to return the appropriately mapped tag.

If I add the required mapping to HdSISD’s GetRenderTag() it fixes the issue. For ex:

if (purposeDs->GetTypedValue(0) == TfToken(“default”))
return HdRenderTagTokens->geometry;

Additionally to confirm this behaviour, I also disabled the token mapping in the usdview’s scene delegate and I could reproduce the issue with usdview as well.

Internally, we are inserting a sceneindex relying mainly on the UsdImagingStageSceneIndex for handle the USD data. So I am unclear if there is anything on our end that could be handled differently?

Let us know if there are workarounds for this and/if any fixes expected to be coming out soon.

Hey Rakesh!

This is a bit unfortunate, but the semantic is that in the hydra domain, “default” is called “geometry”; any token mapping is the responsibility of the scene integration code. Here, that would be UsdImagingDelegate, whose GetRenderTag does the replacement; and also UsdImagingDataSourcePurpose, which likewise pulls the purpose attribute and swaps “default” for “geometry”. We view this as a detail that the concisely named HdSIASD should specifically not be aware of.

If you’re reading USD with UsdImagingStageSceneIndex, I’d expect it to have already done the conversion, so the real question is where the “default” purpose value is coming from… Is there any chance you can figure that out from the hydra scene browser?

Thanks!
Tom

Just so I understand it clearly, is the expectation that UsdImagingStageSceneIndex would already have done the conversion? so purposeDs->GetTypedValue(0) inside HdSIASD should return “geometry”?

Attaching the chain from Hydra Scene Browser.

From 23.08: https://github.com/PixarAnimationStudios/OpenUSD/blob/v23.08/pxr/usdImaging/usdImaging/dataSourcePrim.cpp#L130 … but clearly that’s not what’s going on in your screenshot…

If you’re using a different version, could you check dataSourcePrim.cpp and see if it’s different, or if you’re getting the purpose value from a different codesite? Or if you can repro this in usdview, you can file a github issue and we can take a look.

We are on 23.02 and this is what the corresponding function looks like:

HdDataSourceBaseHandle
UsdImagingDataSourcePurpose::Get(const TfToken &name)
{
if (name == HdPurposeSchemaTokens->purpose) {
return UsdImagingDataSourceAttributeNew(_purposeQuery, _stageGlobals);
}

return nullptr;

}

So it is indeed different.

We will be moving to 23.08 so I will test it with the updated one and check if the issue still persists.

Just wanted to confirm that switching to 23.08 fixes the issue. Thanks, Tom.

Awesome, glad to hear it! :slight_smile: