mtlx2hda.py HDA with correct inputs/outputs but does nothing

   400   5   2
User Avatar
Member
9 posts
Joined: 4月 2024
Offline
Hi

I've been trying to use the mtlx2hda.py to create a HDA from a materialX definition. I managed to create and install the HDA, but it has no effect.
Here are the steps I followed:


I tried with the following very simple materialX:
<?xml version="1.0"?>
<materialx version="1.38">
<nodedef name="ND_basic_color" node="basic_color_shader">
<input name="input_base_color" type="color3" value="1, 0, 0"/>
<output name="out" type="surfaceshader"/>
</nodedef>

<nodegraph name="NG_standard_surface_surfaceshader" nodedef="ND_basic_color">
<standard_surface name="standard_surface_surfaceshader" type="surfaceshader">
<input name="base_color" type="color3" interfacename="input_base_color" />
<input name="base" type="float" value="1" />
</standard_surface>
<output name="out" type="surfaceshader" nodename="standard_surface_surfaceshader"/>
</nodegraph>
</materialx>

It is basically a standard surface shader where I just expose the base color as an input (with a red default value), and set the "base" attribute to a value of 1.

I then use
hython mtlx2hda.py -o <directory_of_the_mtlx_file>/basic_color_shader.hda -p <directory_of_the_mtlx_file>

I get `Processing 1 node definitions`
And the HDA is created.

In Houdini-20, I use a small scene in Solaris, where I create a sphere, and assign a material to it (see attached base_scene).

I then install the HDA (see attached hda_install).

I replace the standard_surface by my new HDA but nothing can be seen, whereas the standard_surface shader node included with houdini works as excepted(see attached assign_mtlx_hda.mp4)

The HDA is created with the correct inputs and outputs, but it acts like an empty shell.
Is there a step I missed ?

Thank you in advance

Attachments:
base_scene.png (115.8 KB)
hda_install.png (130.3 KB)
assign_mtlx_hda.mp4 (4.0 MB)

User Avatar
Member
7785 posts
Joined: 9月 2011
Online
It won't do anything in karma without the corresponding karma nodegraphs

Run mtlx2karma.py too
Edited by jsmack - 2024年4月5日 17:37:52
User Avatar
Member
9 posts
Joined: 4月 2024
Offline
Hi !

Thank you for the reply.

I also ran mtlx2karma.py after creating the hda. Here is the json that got created:
[[["ND_basic_color", [["input_base_color", "color3", [1.0, 0.0, 0.0], ""]], [["out", "surfaceshader"]]]], [["ND_basic_color", "NG_standard_surface_surfaceshader", [["ND_standard_surface_surfaceshader", "standard_surface_surfaceshader", [[1, -1, 0]], [[0, 1.0]]]], [["out", 0, 0]]]]]

I then added the path of the directory of this file to the HOUDINI_PATH.

But I still get not result. Whether I use karma CPU, karma XPU or HoudiniGL.

I did the steps in the following order:
- create HDA with mtlx2hda.py
- create the karma node with mtlx2karma.py
- add the directory to HOUDINI_PATH
- open houdini
- install the HDA
- create the material with my HDA and assign it.

Would there be a way to log what is being loaded in karma ? There is a mention of -V9 in the mtlx2karma script. But I don't know where / when to add the flag ?

Thanks for the help
Edited by mbeaud - 2024年4月8日 10:47:38
User Avatar
Member
7785 posts
Joined: 9月 2011
Online
I'm not sure if it's required, but is the materialX used to create the files also in your HOUDINIPATH?
User Avatar
Member
9 posts
Joined: 4月 2024
Offline
I tried replicating the same path after the HOUDINI_PATH for the materialx.
In Houdini, from the HOUDINI_PATH the structure is as follows: houdini/materialx/libraries/<node_group_directory>/*.mtlx

So I replicated this to where I added the HOUDINI_PATH, and it works !

Thank you for the help !

Althought, it only works in houdini CPU, not in Houdini XPU nor in the viewport (HoudiniGL). Do you know if there is a similar script (to mtlx2karma) to "register" or create the renderer specific node for the Materialx for HoudiniGL and Karma XPU ?

Thanks again !

edit: The mtlx file only need to be in the HOUDINI_PATH, no need to match any directory structure.
Edited by mbeaud - 2024年4月8日 17:32:19
User Avatar
Member
7785 posts
Joined: 9月 2011
Online
mbeaud
Althought, it only works in houdini CPU, not in Houdini XPU nor in the viewport (HoudiniGL). Do you know if there is a similar script (to mtlx2karma) to "register" or create the renderer specific node for the Materialx for HoudiniGL and Karma XPU ?

not that I know of. the nodedef I created worked in all three once I created the karmaNodeGraphs.json and the hda and put the materialX in the path.
  • Quick Links