MaterialX
MaterialX copied to clipboard
WIP: Extending `mix` node to allow per channel mixing
Extending mix
node to allow per channel mixing
The mix node's mix input should allow for all data formats as input and do a per element linear interpolation, not just float. Example given:
in1 = Vector2(1,1)
in2 = Vector2(0,0)
mix = Vector2(1,0)
out = Vector2(1,0)
For backwards compatibility float mixing remains supported.
Adding node definitions with the extra suffix of the mix data type like ND_mix_color3_color3
.
Note: So far I've only tested in MaterialX Viewer, I'm still working on some tests and will try to see results in other renderers.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: friedererdmann / name: Frieder Erdmann (c0cd1a61eed6d6de46ead0c28e927facd5457776)
This proposal looks good to me, thanks @friedererdmann. I'm CC'ing @dbsmythe and @niklasharrysson for their thoughts.
Looks good for GLSL and OSL. See attached renders from the testsuite. For MDL there is a small change needed, see above.
I've updated the v1.39 Spec document to mention support for per-channel fg
and bg
plus a separate 1-channel (float) or N-channel (same type and number of channels as fg
and bg
) mix
input and mixes the fg
and bg
according to the mix value, either uniformly for a "float" mix
type, or per-channel for non-float mix
types.
Looks good! Thanks @friedererdmann
Thanks Niklas for your review and feedback! I don't seem to be able to merge myself, will you merge the PR?