Is color math supported?

Does PB support color math? I’d like to generate 3 functions in the HSV color space and add them together. I’m about to embark on generating the three in HSV space and then convert them to RGB for color math.

Hey Chris!

I think the code you need can be easily adapted from my “Crossfading” pattern in the pattern library (see top of page 2). Is uses an HSV-to-RGB conversion function to blend multiple patterns by summing RGB components in the way you describe.

I’ve also put some thought into blending HSV directly, by envisioning each as a vector in cylindrical HSV space and doing vector addition. I think this might be feasible and less math for faster results in just per-pixel blending.

I didn’t pursue it yet for computing gradients, because the math to compute some desirable paths smoothly (through black/white, around the wheel) involved quaternion math to do slerp.

1 Like