MaterialX Procedurals in Houdini

   1357   2   5
User Avatar
Member
101 posts
Joined: June 2019
Offline
I've recently got interested in MaterialX. Especially I was curious if I can use it for some sort of intermediate thing for procedural patterns. Like to define functions that can then be translated anywhere with support of MaterialX (particularly game engines).

At first Houdini looks like perfect environment to do that so I've decided to create a framework for Houdini to compile python to vop graphs with materialx nodes.

Basically I translate python functions to MaterialX HDAs (which apparently doesn't look right)

I went hardcore and stress test it with phasor noise implementation:


While the shader itself looks very simple it completely breaks the workflow inside houdini


The main problem that custom node with noise got expanded to 8K low level nodes in usd. So Material Library LOP just stops working. Any action inside library takes around 45 seconds and it's always "evaluating Python". I guess it's flattening the whole structure and translating it to usd layer.

So I definitely should forget about implementing anything more complex like fBM phasor noise or 3D version.

Anyways, currently it's not quite working, though I kinda like the idea of MtlX. I was just hoping that I can use basic nodes so I won't be dependent on particular translator. Like of course MaterialX can add phasor noise to specification but then what? Pursue every vendor to implement it on their side? And do that for every new feature? idk doesn't seem viable...

At the end these are my findings through implementation of custom noise:
  1. I guess currently chosen workflow with HDAs from subnets is just wrong. The next step is to try to expand node library with builtin MtlX functionality and using methods from this thread: https://www.sidefx.com/forum/topic/84462/. [www.sidefx.com] Hopefully it resolves issues with graph flattening goes crazy. Though I'm confused with the place of HDAs in materialx context. The proposed way with python doesn't feel natural like using subnet HDAs.
  2. Looks like MaterialX isn't for games (yet). While it's definitely capable of making interop with DCCs much easier, both major engines not supporting it and actually not showing any interest in it. All I can do is to generate glsl shader. Also Substance suddenly stops doing any public work with MaterialX. All of this is a bit worrying.
  3. I'm probably doing something not intended. I'm not from vfx industry so the point of MaterialX is still unclear. But if I can't expand the library with complex patterns without C++ the whole framework feels very rigid. Even inlining OSL won't be portable everywhere, especially for realtime.
  4. Low level nodes in MaterialX are unnecessary limiting

Still, I'll continue experimenting It actually looks promising

The HDAs (including phasor noise, custom perlin, voronoi and hashes for rng) in the attachement. But again, they are barely usable inside lops unfortunately.
Works only in builds more than 19.0.628 and Karma CPU only. XPU works in theory but usually doesn't

Attachments:
phasor.png (4.3 MB)
phasor_shader.png (57.9 KB)
mtlx_functions.hda (197.1 KB)

User Avatar
Member
101 posts
Joined: June 2019
Offline
The one interesting side effect of graph flattening is that generated USDs don't have any dependencies.
It means that I can share USD file and it's going to work without needing any custom HDAs.

Here is the USD scene with phasor noise.

You can just load it via Load Layer LOP (or open hip in the attachment) and see the noise in action. You can even adjust noise parameters to check the procedural nature of the material.
(Also works only on fresh daily builds >19.0.628)

Attachments:
phasor_disp.zip (652.0 KB)

User Avatar
Member
1 posts
Joined: Dec. 2021
Offline
I really like the work you've started here, and I wanted to reach out to see if you'd be interested in contributing more advanced noise nodes to the MaterialX project in the future. Since you've created these as graphs of existing MaterialX primitives, they have the potential to be integrated into the standard MaterialX library as new graph-basednodes, assuming they have a sufficiently general artist interfaces and efficient implementations. We're very interested in improving the standard MaterialX library with richer procedural and noise nodes, and I believe direct contributions from expert users are a very promising path for achieving that.

Here are some details on contributing to the MaterialX project, including links to our main discussion forum on the Academy Software Foundation Slack channel:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/CONTRIBUTING.md [github.com]
  • Quick Links