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:
- 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.
- 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.
- 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.
- 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