var Mixbox = preload("res://addons/mixbox/mixbox.gd")
var color1 = Color(0.0, 0.129, 0.522) # blue
var color2 = Color(0.988, 0.827, 0.0) # yellow
var t = 0.5 # mixing ratio
var color_mix = Mixbox.lerp(color1, color2, t)
print(color_mix)
var z1 = Mixbox.rgb_to_latent(color1)
var z2 = Mixbox.rgb_to_latent(color2)
var z3 = Mixbox.rgb_to_latent(color3)
var z_mix = []
z_mix.resize(Mixbox.LATENT_SIZE)
for i in z_mix.size(): # mix together:
z_mix[i] = (0.3*z1[i] + # 30% of color1
0.6*z2[i] + # 60% of color2
0.1*z3[i]) # 10% of color3
var color_mix = Mixbox.latent_to_rgb(z_mix)
shader_type canvas_item;
uniform sampler2D mixbox_lut; // attach "addons/mixbox/mixbox_lut.png" here
uniform vec4 color1 : hint_color = vec4(0.0, 0.129, 0.522, 1.0); // blue
uniform vec4 color2 : hint_color = vec4(0.988, 0.827, 0.0, 1.0); // yellow
// #include only works in Godot 4, if you are on Godot 3.X
// you will need to paste the Mixbox code here manually.
#include "addons/mixbox/mixbox.gdshaderinc"
void fragment() {
COLOR = mixbox_lerp(color1, color2, UV.x);
}
mat3 z1 = mixbox_rgb_to_latent(color1.rgb);
mat3 z2 = mixbox_rgb_to_latent(color2.rgb);
mat3 z3 = mixbox_rgb_to_latent(color3.rgb);
// mix together 30% of color1, 60% of color2, and 10% of color3
mat3 z_mix = 0.3*z1 + 0.6*z2 + 0.1*z3;
vec3 rgb_mix = mixbox_latent_to_rgb(z_mix);
Copyright (c) 2022, Secret Weapons. All rights reserved.
Mixbox is provided under the CC BY-NC 4.0 license for non-commercial use only.
If you want to obtain commercial license, please contact: mixbox@scrtwpns.com