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.
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?
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”?
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.