24 lines
819 B
GLSL
24 lines
819 B
GLSL
// Flames licking up the stairs, hottest at step 0
|
|
|
|
float hash(float n) { return fract(sin(n * 12.9898) * 43758.5453); }
|
|
|
|
float noise(float x) {
|
|
float i = floor(x);
|
|
float f = fract(x);
|
|
return mix(hash(i), hash(i + 1.0), f * f * (3.0 - 2.0 * f));
|
|
}
|
|
|
|
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
float i = floor(fragCoord.x / iResolution.x * 16.0);
|
|
float v = clamp(i / 12.5, 0.0, 1.0);
|
|
|
|
float flicker = 0.6 * noise(i * 0.6 - iTime * 2.2)
|
|
+ 0.4 * noise(i * 1.3 - iTime * 3.7 + 10.0);
|
|
float heat = (1.0 - v) * (0.45 + 0.75 * flicker);
|
|
heat = clamp(heat, 0.0, 1.0);
|
|
|
|
vec3 col = vec3(smoothstep(0.0, 0.4, heat),
|
|
smoothstep(0.25, 0.85, heat) * 0.75,
|
|
smoothstep(0.75, 1.0, heat) * 0.35);
|
|
fragColor = vec4(col, 1.0);
|
|
}
|