# How to use the Hydra 2.0 API to parse geomSubset types

**URL:** <https://forum.aousd.org/t/how-to-use-the-hydra-2-0-api-to-parse-geomsubset-types/2870>\
**Category:** Hydra\
**Tags:** rendering, cpp, beginner\
**Created:** [March 3, 2026, 2:13am UTC](https://forum.aousd.org/t/how-to-use-the-hydra-2-0-api-to-parse-geomsubset-types/2870 "2026-03-03T02:13:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zitai](https://avatars.discourse-cdn.com/v4/letter/z/a9adbd/32.png) [@zitai](https://forum.aousd.org/u/zitai)\
**Post date:** [March 3, 2026, 2:13am UTC](https://forum.aousd.org/t/how-to-use-the-hydra-2-0-api-to-parse-geomsubset-types/2870/1 "2026-03-03T02:13:54Z")

</div>

At present, I am using the Hydra 1.0 API for parsing `.usd` files. Recently, I learned that upgrading to Hydra 2.0 API has brought many powerful features (thank you to all developers for your contributions). I want to migrate the parsing logic to the Hydra 2.0 API, but I have encountered difficulties.  
Specifically, I created a sphere using `houdini` and divided its material into upper and lower parts using `geomeSubset`. This `.usd` file is used to test the parsing of `geomeSubset`, and the relevant code is as follows:

```cpp
"name": "HD_ENABLE_SCENE_INDEX_EMULATION",
"value": "true"

```

```cpp
void MyRenderDelegate::SetTerminalSceneIndex(const HdSceneIndexBaseRefPtr &terminalSceneIndex) {
    HdRenderDelegate::SetTerminalSceneIndex(terminalSceneIndex);
    sceneIndex = terminalSceneIndex;
    if (!observer) { observer = std::make_unique<MySceneObserver>(this); }
    if (terminalSceneIndex) {
        terminalSceneIndex->AddObserver(HdSceneIndexObserverPtr{observer.get()});
    }
}

void MySceneObserver::TraverseRecursively(
    const HdSceneIndexBaseRefPtr& sceneIndex,
    const SdfPath& currentPath
) {
    const auto scene_prim = sceneIndex->GetPrim(currentPath);
    if (scene_prim.dataSource) {
        const auto flattening_scene_index = HdFlatteningSceneIndex::New(sceneIndex, scene_prim.dataSource);
        const auto flattening_scene_prim = flattening_scene_index->GetPrim(currentPath);
        const auto flattening_child_prim_paths = flattening_scene_index->GetChildPrimPaths(currentPath);
        if (flattening_scene_prim.primType == HdPrimTypeTokens->geomSubset) {
            parse_geom_subset(currentPath, flattening_scene_prim);
        } else if (flattening_scene_prim.primType == HdPrimTypeTokens->mesh) {
            parse_mesh(currentPath, flattening_scene_prim);
        } else if (flattening_scene_prim.primType == HdPrimTypeTokens->instancer) {
            parse_instancer(currentPath, flattening_scene_prim);
        } else if (flattening_scene_prim.primType == HdPrimTypeTokens->camera) {
            parse_camera(currentPath, flattening_scene_prim);
        } else if (
            flattening_scene_prim.primType == HdPrimTypeTokens->distantLight
            || flattening_scene_prim.primType == HdPrimTypeTokens->sphereLight
            || flattening_scene_prim.primType == HdPrimTypeTokens->rectLight
            || flattening_scene_prim.primType == HdPrimTypeTokens->diskLight
            || flattening_scene_prim.primType == HdPrimTypeTokens->cylinderLight
            || flattening_scene_prim.primType == HdPrimTypeTokens->domeLight
        ) {
            parse_light(currentPath, flattening_scene_prim);
        }
    }

    const auto childPaths = sceneIndex->GetChildPrimPaths(currentPath);
    for (const auto& childPath : childPaths) {
        TraverseRecursively(sceneIndex, childPath);
    }
}

```

I have previewed the file using `usdview` and I am sure there is a `mesh` type inside, and there are two `geomSubset` types under that `mesh`. However, I can only traverse to the `HdPrimTypeTokens->mesh` type and retrieve its data, this code cannot traverse the `HdPrimTypeTokens->geomSubset` type.

I have looked up some information about Hydra 2.0, and maybe I should inherit `HdSceneIdexObserver` and rewrite the `PrimsAdd` function. However, I have tried but have not been able to get the data in the `HdPrimTypeTokens->geomSubset` type.

PS:  
OS: Arch Linux x86\_64  
OpenUSD: 25.08  
The `.usd` file: [geo\_subset.usda](https://forum.aousd.org/uploads/short-url/bjrrvHW1FeT0llAcXlV6GieYndz.usda) (18.0 KB)

**Reference**

- [Hydra 2.0 Getting Started Guide](https://openusd.org/dev/api/_page __hydra__ getting __started__ guide.html)
- [Beyond OpenUSD Composition: Generative Procedurals and Customizable Runtime Pipelines in Hydra 2.0](https://www.youtube.com/watch?v=yRoQ2qDAJBE)
- [OpenUSD v24.08 CHANGELOG.md](https://github.com/PixarAnimationStudios/OpenUSD/blob/59992d2178afcebd89273759f2bddfe730e59aa8/CHANGELOG.md?plain=1#L305)
