I am not familiar with this, but this is from our AI.
Your understanding is almost right, but it’s missing an important distinction: registering a scene index plugin with Hydra 2.0 does use HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer inside TF_REGISTRY_FUNCTION, but that’s only one of the ways a custom scene index can be hooked into the pipeline. docs.omniverse.nvidia
What Hydra 2.0 expects
In Hydra 2.0, a scene index is any class deriving from HdSceneIndexBase (often via HdSingleInputFilteringSceneIndexBase) that participates in the scene-index graph. docs.omniverse.nvidia
You can integrate such a scene index in three main ways: docs.omniverse.nvidia
-
Renderer‑specific plugin
Implement HdSceneIndexPlugin, and register it in a TF_REGISTRY_FUNCTION(HdSceneIndexPlugin) block using HdSceneIndexPluginRegistry::RegisterSceneIndexForRenderer(...). docs.omniverse.nvidia
This is the pattern you’re quoting, and it’s how renderer‑specific filters are automatically inserted between the app’s merging scene index and the renderer.
-
Application‑specific registration at startup
An app can call HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer directly at startup, passing a callback that returns your scene index given the input scene. docs.omniverse.nvidia
The Hydra guide shows this as _AppendAppFilterSceneIndexCallback(...) registered from AppStartup(). docs.omniverse.nvidia
-
Manual insertion in your own scene-index graph
If you own the Hydra integration (e.g., in a custom app or renderer), you can bypass the plugin registry and explicitly insert your scene index into the graph (for example via HdRenderIndex::InsertSceneIndex or by composing your own HdMergingSceneIndex chain). docs.omniverse.nvidia
Only the first two rely on RegisterSceneIndexForRenderer; manual insertion does not. docs.omniverse.nvidia
The TF_REGISTRY_FUNCTION pattern
The Hydra 2.0 Getting Started Guide gives exactly the pattern you described for a scene index plugin that should be auto‑loaded: docs.omniverse.nvidia
- First, define your plugin type:
TF_REGISTRY_FUNCTION(TfType)
{
HdSceneIndexPluginRegistry::Define<MyFilterPlugin>();
}
- Then, register it with the plugin registry:
TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
{
const HdSceneIndexPluginRegistry::InsertionPhase insertionPhase = 1000;
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
"GL", // or "Prman", or "" for any renderer
MyFilterPlugin,
/*inputArgs=*/nullptr,
insertionPhase,
HdSceneIndexPluginRegistry::InsertionOrderAtEnd);
}
- Your
MyFilterPlugin derives from HdSceneIndexPlugin and implements _AppendSceneIndex(...) to wrap the incoming scene index in your custom filter. docs.omniverse.nvidia
So: if you want a USD plugin that Hydra discovers via plugInfo and auto‑inserts in the renderer’s pipeline, then yes — this TF_REGISTRY_FUNCTION + RegisterSceneIndexForRenderer pattern is the recommended mechanism. docs.omniverse.nvidia
How this maps to Omniverse
Omniverse builds on standard Hydra 2.0 concepts: custom filters that should apply when a given renderer is active are typically implemented as HdSceneIndexPlugin subclasses plus plugInfo registration, exactly as in the upstream Hydra docs. github
However, Omniverse Kit also has its own higher‑level integration points (e.g., an extension managing Hydra renderers) and may insert additional scene indices on its own. In those cases:
- If you are writing a generic Hydra 2.0 scene index plugin (usable in usdview or other Hydra apps), you should follow the plugin pattern above. docs.omniverse.nvidia
- If you control the Omniverse app/extension and the Hydra setup, you can build or modify the scene‑index chain directly instead of relying on
RegisterSceneIndexForRenderer. github
So the accurate statement is:
To expose a custom scene index as a Hydra 2.0 plugin that is auto‑discovered and auto‑inserted for specific renderers, you must register it via HdSceneIndexPluginRegistry::RegisterSceneIndexForRenderer from a TF_REGISTRY_FUNCTION(HdSceneIndexPlugin) block, and provide the corresponding plugInfo entry.
But it is not the only way to use a custom scene index in Omniverse/Hydra—manual insertion into your app’s scene‑index graph is also valid, and doesn’t require the registry. docs.omniverse.nvidia