Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to mix multiple colors in different proportions, not just 2 colors #6

Open
rider85 opened this issue Jun 29, 2023 · 3 comments

Comments

@rider85
Copy link

rider85 commented Jun 29, 2023

it would be awesome if I could play around with mixing multiple (2+) colors.
In fact I will try to implement it in the active project as soon as several colors are available.

Here are a few examples of implementation:

  1. Chroma-js: https://gka.github.io/chroma.js/#chroma-average
  2. Mixbox:
//   MULTI-COLOR MIXING
//
//      var z1 = mixbox.rgbToLatent(rgb1);
//      var z2 = mixbox.rgbToLatent(rgb2);
//      var z3 = mixbox.rgbToLatent(rgb3);
//
//      var zMix = new Array(mixbox.LATENT_SIZE);
//
//      for (var i = 0; i < zMix.length; i++) { // mix:
//          zMix[i] = (0.3*z1[i] +       // 30% of rgb1
//                     0.6*z2[i] +       // 60% of rgb2
//                     0.1*z3[i]);       // 10% of rgb3
//      }
//
//      var rgbMix = mixbox.latentToRgb(zMix);
@rvanwijnen
Copy link
Owner

When I find the time I will look in to this

@seguso
Copy link

seguso commented Feb 21, 2024

Hi, there, I have the same need: I need to translate this kind of thing:

mixbox_latent finalLat = 0.2 * latUp + 0.3 * latDown + 0.4 * latLeft + 0.1 * latRight;

The context would be

		vec3 up = ...
		vec3 down = ...
		vec3 left = ...
		vec3 right =...
		
		mixbox_latent latUp = mixbox_rgb_toLatent(up);
		mixbox_latent latDown = mixbox_rgb_toLatent(down);
		mixbox_latent latLeft = mixbox_rgb_toLatent(left);
		mixbox_latent latRight  = mixbox_rgb_toLatent(right);
		
                    mixbox_latent finalLat =  0.2  * latUp + 0.3  * latDown + 0.4  * latLeft + 0.1  * latRight;

                    vec3 colBg = mixbox_latent_to_rgb(finalLat);

Thanks!

@rvanwijnen
Copy link
Owner

It’s coming, I have this in my dev version.
No ETA though as I’m working on some other features before 3.0 will be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants