materialx support material variation node?

   4007   6   3
User Avatar
Member
99 posts
Joined: Nov. 2018
Offline
HI, in 19.5 do you know if after i have instanced some assets and i need randomize the diffuse it's possiblie with material variation node using mtlx standard surface?
User Avatar
Staff
449 posts
Joined: Feb. 2008
Offline
Yes, as long as you have a mtlx Geometry Property Value VOP node (the mtlx primvar reader) connected to the mltx Standard Surface's input you want to vary, the Material Variation LOP should show it as an option in the name dropdown and allow you to drive the shading that way.
User Avatar
Member
99 posts
Joined: Nov. 2018
Offline
ok , if i have a mtlximage attached to diffuse where i can attach the mtlxgeometry property value and what attribute i need to put?
User Avatar
Staff
449 posts
Joined: Feb. 2008
Offline
It's really up to how you want to author your shader. Same with the primvar name, give it a name that makes sense to you.

Here's an example where I'm adding a mtlx color correct driven by a "hue" and a "saturation" primvars to color correct a base image texture. The material variation LOP node will show them as potential primvar names you can use to vary the material.
By assigning them random values (enable "use snippet") you can very them per instance.

As a side note, the primvar interpolation created by the material variation LOP node, when used on mesh primitives, will be respected so you can very the material per USD primitive (constant), per face (uniform), per vertex (vertex) or per point (face varying)...

Attachments:
MtlxMatVar.hip (266.0 KB)

User Avatar
Member
99 posts
Joined: Nov. 2018
Offline
thanks, i'll get a look into it
Edited by Piledriver - Sept. 14, 2022 04:20:34
User Avatar
Member
99 posts
Joined: Nov. 2018
Offline
i see that inside the expression you used rand(index) how i can control how much change the hue?
User Avatar
Member
67 posts
Joined: May 2019
Offline
Piledriver
how i can control how much change the hue?

2 years later.. Piledriver, I'm grateful that you asked this question. npetit, I'm grateful for your replies.

In the provided HIP by npetit, add an MTLX Multiply node after hue_primvar, and change the input 2value. Value of 0 = no hue change. Values above 0 increase hue change.

You can add MTLX Add node before MTLX Multiply to shift hue (cycle).

For saturation primvar, add MTLX Multiply after saturation_primvar. Value of 0 = desaturated look.

Edited by AnimGraphLab - Sept. 16, 2024 05:44:04

Attachments:
primvar_changeHUE.png (51.6 KB)

Generalist.
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
  • Quick Links