diff --git a/index.html b/index.html index 4dede697d3d0ea4b12972bde17afba657afb70f2..9e87d5cac3c7ea1c6c20c66401abbfc2791b7ce7 100644 --- a/index.html +++ b/index.html @@ -64,21 +64,23 @@ if (val > 1.0) val = 1.0; if (val < 0.0) val = 0.0; + float numColors = 3.0; + vec3 color = vec3(0.0); - if (val < 0.25) { - val *= 4.0; + if (val <= 1.0/numColors) { + val *= numColors; color = background*(1.0-val) + material1*val; - } else if (val < 0.5) { - val -= 0.25; - val *= 4.0; + } else if (val <= 2.0/numColors) { + val -= 1.0/numColors; + val *= numColors; color = material1*(1.0-val) + material2*val; - } else if (val < 0.75) { - val -= 0.50; - val *= 4.0; + } else if (val <= 3.0/numColors) { + val -= 2.0/numColors; + val *= numColors; color = material2*(1.0-val) + material3*val; } else { - val -= 0.75; - val *= 4.0; + val -= 3.0/numColors; + val *= numColors; color = material3*(1.0-val) + material4*val; }