How to use shading styles unlit, outline, sheer, ect. through USD Stage API?

Hello all,

As we are going to render some specific material style in Storm like unlit, we found a number of USD built-in shading styles in shader terminals.glslfx, e.g. SurfaceUnlit, SurfaceOutline, SurfaceSheer, … But we don’t know how to enable those shading styles from API or usda file. From source code, there seems not way to set. Could you shed light on examples?


Hi @wangfr , I believe the answer is that those styles are not currently activatable through usdImaging, as they were developed for our Presto Hydra adapter, where we do the lionshare of our interactive work. I’ve recategorized this as a “Hydra” topic, as the folks there will be better able to weigh in on what it would take to access the draw styles through usdImaging. I do believe the Autodesk folks make use of them through their own Hydra adapter, but I’m not positive about that.

Thank you @spiff for recategorizing and answer. It makes sense to be more related with Hydra. Yes, as you mentioned we could try adapter as needed, and we also have unlit custom shader to use alternatively. Another side, for custom adapter, it seems HdRenderIndex needs to be updated for more shading terminal added in the HdMesh::ConfigureRepr that found comments read // pre-defined reprs (to be deprecated or minimalized) (linked code location on repo). Is that related and will be deprecated in the short future? Could you help share more information?

Hi Francis,

You’re referring to “repr”, the hydra internal name for different drawing styles. We define a few in hd/renderIndex.cpp: … while we intend to move those out of hd/, the draw styles themselves won’t go anywhere.

In hydra, every prim has an optional attribute specifying the draw style, via scene delegate GetReprDescriptor or scene index “displayStyle/reprDescriptor”. Unfortunately, we don’t have much of a way to author this in UsdImagingDelegate: we have a global style configuration here: For both UsdImagingDelegate and StageSceneIndex, of course, you’re welcome to add the display style in a scene index filter, and in StageSceneIndex you could add one via API schema adapter.

For the styles you’ve found in terminals.glslfx (e.g. outline), those are code stubs to support internal drawing styles, but they aren’t currently accessible in open source. Any application is welcome to add more, and we’re hoping to eventually parameterize the shader snippets that are associated with reprs as well.