Lesson 2 of 10 · Domain warping
Camo
Runway camo. Neither military nor hippie.
Same warp, different cut. You stack three step() at rising thresholds, and the field slices into four zones. Each zone paints a different color. That is how camo is born.
Invisible in the bushes with a cold beer.
Stacked step()The first
step(0.25, f) separates background from wine. The second step(0.45, f) drops charcoal above 0.45. The third step(0.65, f) drops plum above 0.65. Four zones, three cuts.Bring the three thresholds (
0.25, 0.45, 0.65) closer, try 0.4, 0.5, 0.6 and zones tighten. Spread them (0.1, 0.45, 0.85) and each color owns its kingdom.The code
void main(){
vec2 p = gl_FragCoord.xy / R * 3.5;
float warp = fb(p + 1.5);
float f = fb(p + warp * 1.2);
vec3 deep = vec3(0.03, 0.01, 0.05);
vec3 wine = vec3(0.4, 0.08, 0.15);
vec3 charcoal = vec3(0.15, 0.12, 0.18);
vec3 plum = vec3(0.3, 0.12, 0.28);
vec3 col = deep;
col = mix(col, wine, step(0.25, f));
col = mix(col, charcoal, step(0.45, f));
col = mix(col, plum, step(0.65, f));
col *= 0.8 + 0.2 * f;
col += vec3(.1,.05,.08) * pow(f, 5.) * 0.3;
gl_FragColor = vec4(col, 1.0);
}