Correct light data source setup in a custom scene index (non USD related)

Hi guys, I am a bit puzzled. I am in the process of understanding how to correctly setup a light for hydra (using HdStorm (HdStLight)). I am using a custom scene index to manage my scene. All prims are coming from my app, which is not using USD but another scene representation. So far I only have a simple test, so that a mesh can be inserted into my index, which is working fine. Now I want to construct a light in the index.
I looked at the hydra schema for light and saw, that it is supposed to work by specifying a material schema and a light schema as data source (and two others).
I also looked in the code how HdxTaskController (which I am also using) used by UsdImagingGLEngine is handling light setup. There is a SimpleLightTask, which expects a “param” datasource, containing a GlfSimpleLight with all the parameters. I probably could provide this by my scene index but I want to understand how the “param” value is supposed to get into the prim datasource in order to find out the right way to construct a valid light datasource. There seems a lot of legacy stuff going on and I am not sure what would be the right way to setup a light for hydra, which is usable by HdStorm. As I looked on the lightAPIAdapter code I saw in the Get method of its light datasource, that there is a legacy code branch for this “param” value but then it calls LookupLightParamAttribute, which is filtering on some specific light values, so that the param value wouldn’t be fetched from the USD prim even if it would be there. The only place, where a “param” value gets into a light prim datasource I could find, was in HdxTaskController, where it specifies some build in lights in HdxTaskController::_SetBuiltInLightingState.

My questions:

Important:

  1. What would be the correct way to setup a datasource for a light in a custom scene index (without using USD related scene indicies), so that it would be rendered using HdxTaskController and HdStorm?

For my understanding and peace of mind:
2. Is using HdxTaskController a legacy way to use hydra?
3. Does HdStorm currently still need the “param” style to setup its HdStLight prims?
4. Is SimpleLightTask currently the only place where light setup for rendering is done when using HdxTaskController?
5. How does a light specified via LUX schema in USD make it into a prim datasource which is containing the light “param” value aka GlfSimpleLight?

I am still finding my way into hydra and I am missing a documentation how to use it without using USD (just as flexible render API with my own non USD scene data), so I am reading a lot of code and have to ask questions.
It would be cool if you could shed some light into this.

Cheers,
Robert

Hi Robert,
We use a custom scene index (non usd related) to translate maya lights to hydra HdStorm in the open source maya hydra plugin.
So you may want to have a look at our source code, especially the class MayaHydraSimpleLightDataSource :

Regards,
David

Hi David, that helps a lot, thanks!