2
$\begingroup$

I'm looking to create a brick like texture, but with 3 different 'subtextures', so much like in this question: Brick texture with multiple colors . However my problem is that I would like to have (statistically) the same amount of bricks of each color. So the color ramp approach doesn't work for me, because if I have (say) 3 different brick colors, they are chosen randomly from a range of 0-1 and if I set break points in my color ramp at 1/3 and 2/3, then there is no guarantee that out of my 3 colors, one is in the first interval, the second in the second and the third in the last. So that may cause my 3 colors to be reduced to 2 or even 1, depending on the random generator initialization.

Fundamentally I guess my problem is that I need to know the other colors that are used in the brick texture in order to know about how to classify each color, but afaik there is no way to get information for other pixels in each shader invocation (at least not in Blender Nodes). But maybe I'm just going about this the wrong way, because I'm thinking about this as a programmer and how I'd write this as an OpenGL shader. Probably what I need to do is change how I look at the problem, but I can't really figure out how.

I hope the way I phrased this question makes sense - thanks in advance.

$\endgroup$
2
$\begingroup$

OK well as usual, an hour after you ask you find the solution...

Turns out I was misunderstanding how the brick texture works - it doesn't generate a discrete set of colors, it draws a new random color for each brick. So each color is random across the entire color spectrum, and I can classify them using a ColorRamp after all.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.