LOPs custom shader to be used in external renderer.

   1873   7   1
User Avatar
Member
9 posts
Joined: 4月 2021
Offline
Hello! I'm a relatively new user to Houdini, and trying work out the best way to include a new custom USD shader for an external renderer. Is there a standard way to do this?

It seems like the VEX Generic Shader node or Material Builder nodes get me part way there, but so far I haven't been able to put together all the pieces.

My backup plan is to modify the USD with another LOP node after the Principled Shader is added by a Material Library operator. This just feels non-standard, but maybe this is the best way to do it.

How far off am I here? Any feedback is appreciated.
Thanks!
User Avatar
スタッフ
4435 posts
Joined: 7月 2005
Offline
Which external renderer?
User Avatar
Member
9 posts
Joined: 4月 2021
Offline
Proprietary
User Avatar
スタッフ
4435 posts
Joined: 7月 2005
Offline
The the best integration will come from creating custom LOP nodes, and providing a "translator" plugin to translate those VOP nodes into your UsdShade prims. You can look at the modules in $HFS/houdini/python2.7libs/husdshadertranslators for our generic translator implementation, and documentation (in the default.py module) on how to write a custom translator.
User Avatar
Member
9 posts
Joined: 4月 2021
Offline
Thanks for pointing that out! I was able to piece together what to do after reading through the python documentation.

The following worked for me:
  1. Upstream of the Material Library LOP, make sure the custom usd material exsists on the stage
  2. Inside the Material Library LOP place a Specialize USD Material node and pick your custom USD shader. Now you can hook up textures like you would to the regular USDPreviewSurface.
  3. Then collect at the end to include both shaders


NOTE! The Shader Name property inside of the GenericShader node is parsed by the translator to determine the shader source type. So if your shader has a source asset (like mySurface.osl), put that file path in the Shader Name property! Similary, if you leave that name blank, it will use the existing USD.

Attachments:
CustomUSDShaderInputs.png (66.7 KB)

User Avatar
スタッフ
1448 posts
Joined: 7月 2005
Offline
Generic Shader VOP is fine for quick creation of one-off shader nodes, and indeed you can use its Edit Parameter Interface dialog to customize it to your needs. In particular, you will find all the relevant parameters in the Node Property tree branch of VOP Properties > Shader. Similarly, you can further configure your VOP shader node input/output parameters (such as their USD type or name) using the parameter tags listed in the Built-in Tags, in the Standard Shader Tags > USD Shade.

But, if you have a fairly stable and permanent shader, you can define a VOP node (an HDA) for it using File > New Asset > VOPs and choosing USD Surface Shader for the Network Type. Then much of the node can be configured in Node tab (eg, shader name), and for the rest you can use the same configuration method as for the Generic Shader VOP .
User Avatar
Member
9 posts
Joined: 4月 2021
Offline
Rafal, this is super helpful, thanks!

Is this documented anywhere? Being a new user I'm often wondering if I've stumbled onto some undocumented features of Houdini, or if I just don't know where to look.
User Avatar
スタッフ
1448 posts
Joined: 7月 2005
Offline
There is no central page for Solaris shaders, however the above info is all there is to it.

Other than that, most shading user-level concepts carry over from the SOHO-based rendering: https://www.sidefx.com/docs/houdini/shade/index.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/props/vop.html [www.sidefx.com]
  • Quick Links