MaterialX Essentials (Nodes Pack)

   7648   18   12
User Avatar
Member
94 posts
Joined: July 2019
Offline
I have created a set of basic nodes that would help you create MaterialX shaders for Karma XPU.

List of available nodes:
Mtlx Place2D Random
Transform incoming UV texture coordinates in random range.
Mtlx Place3D
Transforms vector in 3D space.
Mtlx Simple Place3D
Simplified node for transforming vector in 3D space.
Mtlx Hash23 Random
Returns random vector.
Mtlx Lehmer Random
Generates random float number.
Mtlx Infinite Tiling
Repeating texture indefinitely without ever repeating exactly.
Mtlx Simple UV Noise
Offsets texture coordinates using noise.
Mtlx Hex Tile Grid
Generates two-dimensional grid made up of hexagon-shaped tiles.
Mtlx Simple Triplanar
Project textures from three axis and blends them together.
Mtlx Frac
Сalculates the fractional part of a value.
Mtlx Degrees to Radians
Converts angle from degrees to radians.
Mtlx Radians to Degree
Converts angle from radians to degree.
Mtlx Round
Round a number to the nearest whole number.
Mtlx Round Decimals
Rounds a given number to a specified number of decimal places.
Mtlx Saturate to Range
Clipping or saturating values that exceed the range limits.

Examples
I have also prepared a hip file with three examples:
Triplanar projection
Planar projection and UV noise
Infinite tiling
How to install:
1. Download Mtlx_Essentials_nodes_pack.zip from attachments below.
2. Extract the archive and copy to files to Houdini preference folder - otls (Houdini 19.5/otls).
Note: Only HDALC(indie) version of nodes is available.
3. Download MaterialX_Essentials_Examples.hiplc from attachments below.
4. Run the file to see examples.

FAQ:
"How can these nodes be applied?"
I created these nodes to be able to replicate the tutorials for Unreal Engine and Unity from Ben Cloward's youtube (https://www.youtube.com/@BenCloward) channel. You can also follow along with them.
"Are the coordinate systems of UE and Unity compatible with Houdini?"
MaterialX nodes resemble those of game engines, but their coordinate systems are actually different. Unity is somewhat closer to Houdini because Y points up, but in Unity, Z points in the opposite direction.
"I don't see equivalents for some nodes, what should I do?"
MaterialX is still in development, and some nodes may be missing, but many nodes simply have a different name or can be substituted with basic mathematical functions.
Here are some nodes from UE or Unity and their counterparts in MaterialX, for examples:
Lerp (UE/U) = Mix (Mtlx), A = Bg (input 2), B = Fg (input 1)
SplitComponents(UE)/Split(U) = Separate (Mtlx)
Append(UE)/Combine(U) = Combine (Mtlx)
One Minus (UE/U) = Complement (Mtlx Houdini)
Abs(UE) = Absval(Mtlx)
Reciprocal(U) = 1/X (Math)
Saturate = Saturate to Range(Mtlx Essentials)
Fraction(U) = Frac (Mtlx Essentials)
UV Transform(U) = Place2D (Mtlx)
Vertex Color(UE) = Geometry Color(Mtlx)
Position Vector(U) = Position (Mtlx)
Normal Vector(U) = Normal(Mtlx)

Have fun!
Edited by Faitel - March 9, 2023 05:57:41

Attachments:
Nodes List.jpg (250.8 KB)
Triplanar.jpg (327.7 KB)
Planar.jpg (310.6 KB)
Infinite.jpg (409.6 KB)
MaterialX_Essentials_Examples.hiplc (1.2 MB)
Mtlx_Essentials_nodes_pack.zip (167.2 KB)

User Avatar
Member
5 posts
Joined:
Offline
Thank you very much.
User Avatar
Member
7740 posts
Joined: Sept. 2011
Offline
These are HDALC which makes them not usable in commercial projects, FYI
User Avatar
Member
464 posts
Joined: Aug. 2014
Offline
These are HDALC which makes them not usable in commercial projects, FYI
I'm not trying to be spiteful, @jsmack, but Indie files can be used in commercial projects, FYI.

If a studio earning more than $100,000 annually wants @Faitel to convert his .hdalc files to .hda to legally comply with their FX licences, then I guess nothing stands in their way of presenting him a full Houdini FX license, right? I mean to such a studio an expense like that would be peanuts.

One can also ask SideFX to convert @Faitel's nodes for the greater good, or simply rebuild those nodes manually.

I'm saying all that, because I am oversensitive to situations in which someone spends his time on something useful for the community, and is publishing it not only free of charge, but also as an open asset which we can study, and yet there is always someone who complains about this in one way or another. I'm sorry, but I've seen it way too many times in libre software to let it pass without a comment.
User Avatar
Member
7740 posts
Joined: Sept. 2011
Offline
ajz3d
These are HDALC which makes them not usable in commercial projects, FYI
I'm not trying to be spiteful, @jsmack, but Indie files can be used in commercial projects, FYI.

I'm aware that "Indie" is for commercial use, but there isn't any other way to distinguish a non-indie license. Commercial in this sense means the regular version of Houdini.

ajz3d
I'm saying all that, because I am oversensitive to situations in which someone spends his time on something useful for the community, and is publishing it not only free of charge, but also as an open asset which we can study, and yet there is always someone who complains about this in one way or another. I'm sorry, but I've seen it way too many times in libre software to let it pass without a comment.

Not a complaint at all. I'm grateful for those that publish their work for others.

I mean to give a warning that the nodes can't be used in the full commercial version of Houdini as they will convert the session to an indie one, possibly resulting in hours of lost work as the resulting indie hip file cannot be used in a full session.

If anything, this is a complaint against sidefx. The license structure creates a divide between classes of users, and prevents open source collaboration that would otherwise be possible with a more permissive license.
Edited by jsmack - March 8, 2023 23:11:04
User Avatar
Member
94 posts
Joined: July 2019
Offline
Thank you for your comments guys, I have taken them into account and added a license warning in How to install section. I apologize for any inconvenience that this may have caused. This is all I can do at the moment.
User Avatar
Member
464 posts
Joined: Aug. 2014
Offline
jsmack
Not a complaint at all. I'm grateful for those that publish their work for others.

In this case, I apologize for misinterpreting the tone of your post. I hope you didn't take offense.

jsmack
I mean to give a warning that the nodes can't be used in the full commercial version of Houdini as they will convert the session to an indie one, possibly resulting in hours of lost work as the resulting indie hip file cannot be used in a full session.

I remember there was a time when Houdini didn't warn users about the switch from Indie to Non-Commercial taking place when a hipnc file was opened from a running Indie instance. I assume the behavior was the same when opening an Indie file from Houdini FX instance. If one didn't pay attention to the little textual indicators scattered in several regions of the user interface, he could not have even realized that he's now operating in a different license environment, and it's indeed true that because of that hours of work could be easily lost.

Things improved slightly in this subject when SideFX added a popup modal dialog that warns users that they're trying to open a more restricted format from a less restrictive session, so the chance of making a mistake was lowered a bit, albeit not completely, because starting Houdini by loading a lower-tier scene can still lead to problems if one's not careful.

But there's also a different, more hidden problem which is exclusive to Indie files. When Indie licenses came out for the first time, I tried to study them carefully, and I came up with a conclusion (perhaps a wrong one), that if one mixes Indie files coming from different artists ("Eligible Indies"), then the collective sum of those artists' annual revenues counts to that $100,000 limit imposed by Indie license. So just to be on the safe side, as Indie license owner I always rebuild downloaded Indie files from scratch if I intend to incorporate them into my pipeline. Though it's time-consuming, one positive aspect is that I can learn something new in the process.

jsmack
If anything, this is a complaint against sidefx. The license structure creates a divide between classes of users, and prevents open source collaboration that would otherwise be possible with a more permissive license.

Can't agree with you more on this.
User Avatar
Staff
1182 posts
Joined: July 2005
Online
If you upload your HDAs to Orbolt they will get converted to HDA files.
Robert Magee
Senior Product Marketing Manager
SideFX
User Avatar
Staff
4159 posts
Joined: Sept. 2007
Offline
These are great, nice work @Faitel!

In addition to Orbolt, have you considered making some PR's upstream to the MaterialX project? Here are some that we've contributed recently:


If you check out those PR's they can give you a feel for what it took for the PR to be accepted. There were also some discussions on #materialx channel of ASWF slack. Some of these nodes feel like they'd be good nodegraph contributions. The MtlX TSC may prefer some of them to be lower-level, and implemented in code for their codegen targets (OSL, GLSL, MDL, and soon Metal), but it wouldn't hurt to submit a PR.

The MtlX Graphs can be output from HDAs pretty easily (using vop2mtlx.py that ships with Houdini), then hand-edited into the standard library files (which is how I did it for those PRs). Or you could try the new MaterialX Graph Editor, and see if that's easier.
Edited by goldleaf - March 15, 2023 22:09:27
I'm o.d.d.
User Avatar
Member
8528 posts
Joined: July 2007
Online
goldleaf
The MtlX TSC may prefer some of them to be lower-level, and implemented in code for their codegen targets
how does one implement a new node that works for all MtlX renderers?
I assume implementing codegen targets will not make it work for Karma since we've been told Karma is not using any of those languages
But if Nodegraph doesn't have many basic functions what are the options if we don't want to implement basic libraries (like random, matrix math, quaternions, ...) using only available very elemental math functions from scratch?
Edited by tamte - March 17, 2023 18:28:19
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
94 posts
Joined: July 2019
Offline
tamte
goldleaf
The MtlX TSC may prefer some of them to be lower-level, and implemented in code for their codegen targets
how does one implement a new node that works for all MtlX renderers?
I assume implementing codegen targets will not make it work for Karma since we've been told Karma is not using any of those languages
But if Nodegraph doesn't have many basic functions what are the options if we don't want to implement basic libraries (like random, matrix math, quaternions, ...) using only available very elemental math functions from scratch?

As far as I understand, Materialx takes care of transliterating the code itself, and it's unlikely that we will get access to the level of shader languages.
https://materialx.org/assets/ASWF_OSD2021_MaterialX_slides_final.pdf [materialx.org] Page 82

It seems that it makes sense to cooperate more around developers of the standard rather than dcc or render engine, at least until we have enough low-level functions.

Attachments:
Screenshot_20230318_124717.png (139.7 KB)

User Avatar
Staff
4159 posts
Joined: Sept. 2007
Offline
tamte
how does one implement a new node that works for all MtlX renderers?
I assume implementing codegen targets will not make it work for Karma since we've been told Karma is not using any of those languages
But if Nodegraph doesn't have many basic functions what are the options if we don't want to implement basic libraries (like random, matrix math, quaternions, ...) using only available very elemental math functions from scratch?

Karma is unique, but adding a new node for all MaterialX renderers, requires adding support to the various shading languages MaterialX supports, if it cannot be built using nodegraphs. When new code-implemented shaders are added to the standard library, than SideFX would need to add support to Karma CPU/XPU for a given node.

As of today, Karma doesn't provide a way for users to Karma/MtlX code-implemented shaders. We know it's something many people expect/need. For now the only low-level shader authoring support we have is pure VEX shaders for Karma CPU.
Edited by goldleaf - March 18, 2023 22:04:39
I'm o.d.d.
User Avatar
Staff
4159 posts
Joined: Sept. 2007
Offline
For those who are interested in some of the stuff @tamte is referring to, here is a little summary. Hopefully it provides a bit of context.

MaterialX makes artist-produced looks portable between renderer/shading language details. The shader definitions (i.e. nodedefs) can be implemented by code or as nodegraphs. Most renderers use their supported code generator (OSL, MDL, etc..) to generate shaders for their renderer, from the .mtlx documents.

When a new nodedef is code-implemented, support for the different shading language code-generators is expected. That's the downside to the code approach, as it can take longer to get those ready for contribution. The up-side is you can do whatever the shading languages support. OSL, MDL, GLSL, (and now Metal [github.com]) all have their differences/quirks, but at this level one is dealing with actual shading languages. An example is Worley's GLSL implementation [github.com], as contributed by Mark Elendt.

If a nodedef is implemented as a nodegraph, the existing codegen will just work. However you are limited to working with existing nodes, and not a shading language. Some lower-level behavior required by in shaders may be difficult or impossible to implement. Or the implementation is exceedingly awkward and requires vast numbers of nodes.

As mentioned in the previous message, Karma doesn't use MaterialX's codegen. Code-implemented nodedefs are written in VEX or C++, by Karma developers. Nodegraph-implemented custom MtlX shaders only need mtlx2karma.py(json-representation/registration) and and mtlx2hda.py(create VOP node for users), to be usable by Karma.
I'm o.d.d.
User Avatar
Member
44 posts
Joined: March 2023
Offline
Hello this might be a good place to ask if anyone know if there is a way to filter the heightmaps so sudden peaks in height on the edges between diferent seeds.

this seems like it should be really eazy to program just a low pass filter that `s only active on edge detection or furthest from center.

Or is it that a filter operation is incredibly slow on a shader ?
User Avatar
Member
83 posts
Joined: Feb. 2019
Offline
Hi,I would like to know how to create a more detailed Noise pattern with MTLX node,just like like Arnold noise below?

Attachments:
NOISE.jpg (198.0 KB)

User Avatar
Member
44 posts
Joined: March 2023
Offline
happybabywzy
Hi,I would like to know how to create a more detailed Noise pattern with MTLX node,just like like Arnold noise below?


I`ve atached a file with a similar matx node setup, you could pack it into a subnet.

Attachments:
matxnoise_terable3.hiplc (336.0 KB)

User Avatar
Member
83 posts
Joined: Feb. 2019
Offline
nicolaas.tanghe
happybabywzy
Hi,I would like to know how to create a more detailed Noise pattern with MTLX node,just like like Arnold noise below?


I`ve atached a file with a similar matx node setup, you could pack it into a subnet.

Thank you very much for your help ~
User Avatar
Member
44 posts
Joined: March 2023
Offline
Hello,

I`ve been trying to get the hextile UV`s to also be solid tiles instead of seperate squares each.

In general just keep the mask and have a seed number on each hextile.
I`ve been trying to use trail and error, and it realy hasn`t gotten me far.

If someone knows a way to sample an area so that each non connected piece is a seperate float or int,
That whould be of great help.
User Avatar
Member
350 posts
Joined: June 2016
Offline
Thanks for sharing!
Minor corrections I believe are needed on the MtlxImage node signatures in the example .hip. For Roughness and Height maps I believe you should change the Signature to Float from Color.

And if using a Normal map, use Vector instead of Color.
Edited by art3mis - Aug. 26, 2023 10:58:39
  • Quick Links