44 lines
1.6 KiB
GLSL
44 lines
1.6 KiB
GLSL
#version 330
|
|
// FBC: NIGHT SHIFT - corruption wave around Hiss units.
|
|
// Everything below is an SDF: radial distance, one expanding ring front and a
|
|
// ragged silhouette. One quad, a dozen ALU ops, no texture fetches.
|
|
in vec2 vUv;
|
|
out vec4 finalColor;
|
|
|
|
uniform vec4 colDiffuse;
|
|
uniform float uTime;
|
|
uniform float uPhase;
|
|
uniform float uCorruption;
|
|
uniform float uIntensity = 1.0;
|
|
|
|
void main()
|
|
{
|
|
vec2 p = vUv * 2.0 - 1.0;
|
|
float r = length(p);
|
|
if (r > 1.0) discard;
|
|
|
|
float t = uTime * 1.1 + uPhase;
|
|
|
|
// Wave front SDF sits outside the model silhouette, breathing outward.
|
|
float front = 0.66 + 0.10 * sin(t * 1.3);
|
|
float ring = 1.0 - smoothstep(0.0, 0.11, abs(r - front));
|
|
// A second, slower front drifts from the core to the edge.
|
|
float travelling = fract(t * 0.16);
|
|
ring = max(ring, (1.0 - smoothstep(0.0, 0.09,
|
|
abs(r - travelling))) * (1.0 - travelling) * 0.55);
|
|
|
|
// Ragged outer edge from two cheap angular waves - no noise texture.
|
|
float ang = atan(p.y, p.x);
|
|
float ragged = 0.88 + 0.07 * sin(ang * 7.0 + t * 1.7)
|
|
+ 0.04 * sin(ang * 13.0 - t * 1.1);
|
|
float body = 1.0 - smoothstep(ragged * 0.30, ragged, r);
|
|
float inner = 1.0 - smoothstep(0.0, 0.52, r);
|
|
|
|
vec3 dark = vec3(0.008, 0.004, 0.008);
|
|
vec3 crimson = vec3(0.26, 0.015, 0.026);
|
|
vec3 col = mix(dark, crimson, clamp(ring * 0.85 + (1.0 - inner) * 0.14, 0.0, 1.0));
|
|
|
|
float a = body * (0.34 + 0.16 * uCorruption) + ring * 0.30;
|
|
a *= smoothstep(1.0, 0.62, r);
|
|
finalColor = vec4(col * colDiffuse.rgb, a * colDiffuse.a * uIntensity);
|
|
}
|