Edit MtlX Standard Surface?

   2480   10   2
User Avatar
Member
161 posts
Joined: 1月 2019
Offline
I would like to do some minor edits to the MtlX Standard Surface. Is there a version of the shader that's made from individual nodes?

If not could it be made available? It would be a great learning resource too.
User Avatar
Member
2536 posts
Joined: 6月 2008
Offline
There's a couple of ways to approach that. One is to set some value on the MTLXStandardSurface node that you want to persist, then right-click and choose Make Permanent Default. Then any new creations of the MTLXStandardSurface will contain your edits.

If you drop down a USD MTLXSubnet and dive inside, you'll discover the barebones version of a surface that you can edit for your needs.
In LOPs there is also the editmaterialproperties node to non-destructively modify parameters.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
161 posts
Joined: 1月 2019
Offline
I'm looking to edit the core functionality of the shader, so would need lower level access to the mtlx nodes that make up the MTLXStandardSurface.

The specific edit I'm looking to make is decoupling, the IOR of reflection and refraction. So they have their own IOR value, this is an artistic choice, and is something we do in VRay but looking to replicate in Karma CPU and XPU.
User Avatar
Member
29 posts
Joined: 3月 2017
Offline
The only thing I can think of is to rebuild it from bsdfs. Not ideal if you only need a minor change but it does give you full control over the shader.

Doesn't work with xpu yet though as far as I'm aware.

Here's a tutorial on bsdf based shader setups in case it's helpful.

https://youtu.be/FVmFFn7EPdA [youtu.be]
User Avatar
スタッフ
1448 posts
Joined: 7月 2005
Offline
MtlX Standard Surface is a MaterialX shader, which means there is a single VOP (and Karma shader node on Karma side) that represents it, so you can't dive inside to see the implementation details.

However, that shader node is implemented as a network in MaterialX: $HH/materialx/libraries/bxdf/standard_surface.mtlx

This means you could take that MaterialX file and edit it to come up with your own version of the shader. Of course, it should be named differently etc. But once you have your own .mtlx file with your own shader, you can use `mtlx2hda.py` and `mtlx2karma.py` scripts to build the VOP and Karma shader node that are needed for the shader UI in Houdini and the execution implementation for Karma.

See also:
https://www.sidefx.com/forum/topic/83604/ [www.sidefx.com]
https://www.sidefx.com/forum/topic/83563/ [www.sidefx.com]
User Avatar
Member
161 posts
Joined: 1月 2019
Offline
Hi Rafal,

Thanks for your explanation and links to the resources.

I had started rebuilding the MtlX Standard Surface from bsdfs like pixelninja mentioned, but released they don't work in karmaXPU.

Will I have the same issue when using `mtlx2hda.py` and `mtlx2karma.py` method?

David.
Edited by daviddeacon - 2023年3月20日 12:50:27
User Avatar
スタッフ
4162 posts
Joined: 9月 2007
Offline
Yeah Beta XPU doesn't yet support the various BSDFs. You will not be able to create standard surface from scratch and render with XPU. Even if you build a nodedef/nodegraph using those python scripts.
I'm o.d.d.
User Avatar
Member
161 posts
Joined: 1月 2019
Offline
Okay, that's going to be a blocker for what I want to achieve. I will log an RFE as it might be simpler/quicker to add, than getting the individual BSDFs supported in XPU.
User Avatar
Member
7762 posts
Joined: 9月 2011
Offline
daviddeacon
Okay, that's going to be a blocker for what I want to achieve. I will log an RFE as it might be simpler/quicker to add, than getting the individual BSDFs supported in XPU.

It's the same blocking feature.
User Avatar
Member
7762 posts
Joined: 9月 2011
Offline
rafal
MtlX Standard Surface is a MaterialX shader, which means there is a single VOP (and Karma shader node on Karma side) that represents it, so you can't dive inside to see the implementation details.

However, that shader node is implemented as a network in MaterialX: $HH/materialx/libraries/bxdf/standard_surface.mtlx

This means you could take that MaterialX file and edit it to come up with your own version of the shader. Of course, it should be named differently etc. But once you have your own .mtlx file with your own shader, you can use `mtlx2hda.py` and `mtlx2karma.py` scripts to build the VOP and Karma shader node that are needed for the shader UI in Houdini and the execution implementation for Karma.

See also:
https://www.sidefx.com/forum/topic/83604/ [www.sidefx.com]
https://www.sidefx.com/forum/topic/83563/ [www.sidefx.com]

Is there a trick to these? I tried mtlx2karma, and the result just hard crashes Houdini when I try to render with Karma using the new NodeDef.
User Avatar
Member
7762 posts
Joined: 9月 2011
Offline
I've submitted a support ticket:

https://www.sidefx.com/bugs/#/bug/127896 [www.sidefx.com]
  • Quick Links