This provides a new option to hash input values to a color.
It was done this way as an optimisation so that the color hash is only computed if it is needed.
I've checked the other textures and there is a variety of things going on. Voronoi color is cell color. Gradient and Wave just copy fac to color so it is grey. Magic averages the color. Noise seems to be optimised for Cycles but not for GLSL or Eevee. Checker and Brick manipulate the fac to add colors. Musgrave doesn't have a color output.
Some possible choices:
- Leave as it is. Let the user decide what hash output they want.
- Display both sockets. For color mode we could average the colour into the value socket like magic texture does. For value mode we could just covert the color socket to grey like the Gradient and Wave nodes.
- Display and calculate both sockets. Remove option.
Notice that OSL and GLSL optimize this on their own. If the color output is not used, it will not be computed. This is not the case for SVM, so we have to add the optimization manually.
Consistency across the nodes available is more important than anything and should be the number one design rule for any UI, having inconsistent UI for the sake of micro optimizations is not the way to go imho, when in doubt consult the UI team cc: @William Reynish (billreynish)
In the past some optimizations were done by checking if the node was connected at-least in SVM if the other codepaths (glsl, osl) never had these optimizations there is no need to break with that now.
I'll leave the final decision up to brecht (don't change anything until he has given feedback) as he is the architect here but i suggest for this diff:
- Display both outputs, remove the drop down.
- Optimize SVM only calculate what is needed
- Leave OSL/GLSL unoptimized
- Handle optimization of all nodes that need it in glsl/svm in a different diff, keeping in mind that changing the UI for the sake of optimization can perhaps be done (given you have compelling benchmark numbers to justify it and a good reason why it can't be done keeping the current UI) but has to be done across all nodes, consistency is key
4 can perhaps also be an idea for GSOC ? (part of, I don't think there is enough substance for a complete GSOC project there)