Skip to content
Snippets Groups Projects
Commit 0470ca5b authored by amandaghassaei's avatar amandaghassaei
Browse files

colors

parent f2753dd5
Branches
No related tags found
No related merge requests found
...@@ -64,21 +64,23 @@ ...@@ -64,21 +64,23 @@
if (val > 1.0) val = 1.0; if (val > 1.0) val = 1.0;
if (val < 0.0) val = 0.0; if (val < 0.0) val = 0.0;
float numColors = 3.0;
vec3 color = vec3(0.0); vec3 color = vec3(0.0);
if (val < 0.25) { if (val <= 1.0/numColors) {
val *= 4.0; val *= numColors;
color = background*(1.0-val) + material1*val; color = background*(1.0-val) + material1*val;
} else if (val < 0.5) { } else if (val <= 2.0/numColors) {
val -= 0.25; val -= 1.0/numColors;
val *= 4.0; val *= numColors;
color = material1*(1.0-val) + material2*val; color = material1*(1.0-val) + material2*val;
} else if (val < 0.75) { } else if (val <= 3.0/numColors) {
val -= 0.50; val -= 2.0/numColors;
val *= 4.0; val *= numColors;
color = material2*(1.0-val) + material3*val; color = material2*(1.0-val) + material3*val;
} else { } else {
val -= 0.75; val -= 3.0/numColors;
val *= 4.0; val *= numColors;
color = material3*(1.0-val) + material4*val; color = material3*(1.0-val) + material4*val;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment