Exporting out as MaterialX

   4786   11   3
User Avatar
Member
695 posts
Joined: 8月 2013
Offline
Hi. Woudl anyone know how to export materialX subnets out as a Material X shader?

Best

Mark
User Avatar
Member
8037 posts
Joined: 9月 2011
Online
I'm not sure if you can from Houdini. It seems like solaris can't make use of materialX nodegraph based shaders either. Only the built-in ones have worked for me.
User Avatar
スタッフ
1454 posts
Joined: 7月 2005
Offline
There is a `vop2mtlx.py` script that exports a VOP HDA as a Material X shader. This is how we generate ramp .mtlx from the HDAs.

There is also `saveShaderNetwork()` function in there, that can save .mtlx from VOP nodes rather than HDA. But it can only handle one-level of subnet, since currently MaterialX does not officially support nested compound node graphs. Compound node graph is one that does not specify shader node definition (nodedef).
User Avatar
Member
729 posts
Joined: 7月 2005
Offline
So essentially materials have to live at the root of the material library if we want to export .mtlx?
User Avatar
スタッフ
1454 posts
Joined: 7月 2005
Offline
Not necessarily. You should be able to right-click on any VOP node > Save > MaterialX...

This menu item essentially calls vop2mtlx.saveShaderNetwork(), which traverses the input chains. If one of the node in an input chain is a subnet, that subnet will be saved as a node graph. But if that subnet has another subnet inside, it will result in an error, because MaterialX node graph can't have another node graph inside.
User Avatar
Member
695 posts
Joined: 8月 2013
Offline
Hi all. I just came across this which may help...

https://www.youtube.com/watch?v=RpShFmwjMzg [www.youtube.com]

Best. Mark
User Avatar
Member
56 posts
Joined: 10月 2019
Offline
rafal
Not necessarily. You should be able to right-click on any VOP node > Save > MaterialX...

This menu item essentially calls vop2mtlx.saveShaderNetwork(), which traverses the input chains. If one of the node in an input chain is a subnet, that subnet will be saved as a node graph. But if that subnet has another subnet inside, it will result in an error, because MaterialX node graph can't have another node graph inside.

Hello,
I'm testing this right now and I can't for the world in me read the mtlx file back in again. When I test with the built in shader examples it's works (testing standard_surface_chrome.mtlx as example).
But if I create a standard surface and then export that it will not work.
If I copy paste the code from the mtlx file but change the name from "SR_Chrome" to "My_Test"., and also the same for nodename..it will not work.

So is there anything else we can do to make it work?
Testing this on 19.0.561 (linux)

regards
stefan
CG Supervisor - Important Looking Pirates
http://www.ilpvfx.com/ [www.ilpvfx.com]
User Avatar
スタッフ
1454 posts
Joined: 7月 2005
Offline
The terminal node in your VOP network may need to be the "Mtlx Surface Material" VOP. Ie, you need to feed your standard surface to it as an input. Otherwise USD file plugin won't detect which shader to start loading from.
User Avatar
Member
2 posts
Joined: 4月 2022
Offline
rafal
The terminal node in your VOP network may need to be the "Mtlx Surface Material" VOP. Ie, you need to feed your standard surface to it as an input. Otherwise USD file plugin won't detect which shader to start loading from.

Hello Rafal,
Without Mtlx surface material node it will not write anything to the xml file. but with mtlx surface material node to export from houdini will not write the shader under <nodeGraph> so it will read just the shader when importing it back without any other nodes connected to that shader like mtlxImage or any other nodes. I know clarisse can read the .mtlx file even if it hasn't <nodeGraph>. but houdini can't!

So, what should i do to export correctly a materialX shader from Houdini and read it back in houdini without losing the nodes connected to the main shader?
User Avatar
Member
8037 posts
Joined: 9月 2011
Online
azab4d
So, what should i do to export correctly a materialX shader from Houdini and read it back in houdini without losing the nodes connected to the main shader?

I don't think you can round trip mtlx yet.
User Avatar
Member
1 posts
Joined: 7月 2024
Offline
Hello,

I have been using solaris USD for a while now

I am facing a issue when I am trying to export the shader in .mtlx,

I have been checking the AMD GPUopen .mtlx and MOEEN SAYED OpenChessSet .mtlx formats are same, but when I try to export the shader from houdini the code looks different, and it works in houdini but not in unreal due to the difference in code

has anyone faced this issue, or can anyone let me know the proper process of exporting the shader as .mtlx and works in unreal with materialX shader (not display or preview shader), I will send the snaps as well if required

Thanks in advance.
User Avatar
Member
199 posts
Joined: 11月 2013
Offline
Watch this video for info: https://www.youtube.com/watch?v=SATZxxZqBDk [www.youtube.com]
About 12:50 it starts talking about how exporting .mtlx from Houdini gives a different result than expected.
  • Quick Links