Hey there!
I'm kinda new to SD (and to this cool forum!) and I'm trying to create color variation for a simple tile texture.
the logic is that I want the user to pick how many color he want to have, and add weight sliders per every color.
here is an example for hard coded one with some histogram select:






The issue here is that the color are overlapping, if yellow color will have high range and green small they might overlap and not show any green one...and its not generic, if I want to add another color I need to add a lot of nodes.
So I tried new a approach figuring out with numbers inputs and functions:
Deciding there are 3 number (user input - 8,1,1) based on that u get the range for every color. (the user input is not the percent its how much every number effect the "total value" and then it calculate the percent...in other word its weight.)


now I'm stack with how to use that float3 in histogram select and making sure there are no overlapping (something with the position maybe?).
also I have couple of questions

:
1) Is there a way to make it dynamic? like if the user decide to have 3 color and then switch to 5 can I create a for loop or something? or deciding on max value and creating the edge case is the best way?
2) I cant use more then 4 colors with this way cause it limited by the float variable...is there a better way for that?
3)I'm still not familiar with all the nodes in SD so I'm checking...is there a node that do that? :P
Would love to here your opinion about how you solve this and if this even useful/necessary to have this feature.
Replies
Is it ..
User defines n colors
Colors are selected randomly but the chance of each colour being selected is affected by a user selected weight
?
if user chose 3 colors then 3 sliders will appear, color will select randomly but the sliders will control the chance of their appearance, the most important part is that they all share 100% and not overlap on each other. (sum of all chances for all colors will be 1/100%).
in these simple examples I generate a random luminance per cell (you could do this with flood fill or any of the tile nodes)
apply a curve/level/histogram scan - all of these ensure that your summed weights == 1 and allow you to reshape the distribution of values.
quantize the result ( set levels to number of colors you want)
autolevels it to get full range
this gives you a mask that you can use to generate your colors using a gradient map or some custom solution
This shows what you get by adjusting the curve - you could achieve the same by modifying the level in mid parameter on a levels node
You could skip the curve adjustment by simply modifying the gradient map - there's plenty of options.
I didn't know about the quantize grayscale node its really cool.
Now what left is just export param the steps, gradient and curve, much more cleaner approach then what I thought (somehow I always tend to over complicate simple staff )
Thanks a lot for your help! that exactly what I needed, you're awesome!
your original idea isn't wrong and if you had hard requirements for your input design it might be the best way to go about it.
i just reframed the problem.
also i dont think you can parameterise the curve - you could replace it with a levels or some sort of input (gradient into a curve might work)