Skip to content

Commit 2390844

Browse files
authored
[New Shader] - Freeze shader
1 parent a47d52e commit 2390844

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

source/shaders/freeze/freeze.mp4

1.08 MB
Binary file not shown.

source/shaders/freeze/freeze.png

332 KB
Loading

source/shaders/freeze/index.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
description: A shader that simulates a progressive freezing effect, creating a transition from normal to frozen state.
3+
shader:
4+
title: Freeze
5+
description: This shader progressively simulates a freezing effect on the screen
6+
screenshot: freeze.png
7+
video: freeze.mp4
8+
# For the moment we need to record the path to this directory until Static Shock provides this
9+
directory: shaders/freeze/
10+
---
11+
```glsl
12+
// based on https://www.shadertoy.com/view/MsySzy
13+
// Experiment: Frosted Glass II by Shadmar
14+
// Original by Jack Davenport : https://www.shadertoy.com/view/MtsSWs#
15+
16+
#version 460 core
17+
18+
precision mediump float;
19+
20+
#include <flutter/runtime_effect.glsl>
21+
22+
uniform vec2 iResolution;
23+
uniform float progress;
24+
uniform sampler2D image;
25+
26+
out vec4 fragColor;
27+
28+
#define FROSTYNESS 2.0
29+
#define COLORIZE 1.0
30+
#define COLOR_RGB 0.7,1.0,1.0
31+
32+
float rand(vec2 uv) {
33+
34+
float a = dot(uv, vec2(92., 80.));
35+
float b = dot(uv, vec2(41., 62.));
36+
37+
float x = sin(a) + cos(b) * 51.;
38+
return fract(x);
39+
}
40+
41+
void main( ) {
42+
vec2 fragCoord = FlutterFragCoord().xy;
43+
vec2 uv = fragCoord.xy / iResolution.xy;
44+
vec4 d = texture(image, uv);
45+
vec2 rnd = vec2(rand(uv+d.r*.05), rand(uv+d.b*.05));
46+
47+
//vignette
48+
vec2 lensRadius = vec2(progress, 0.05);
49+
float dist = distance(uv.xy, vec2(0.5,0.5));
50+
float vigfin = pow(1.-smoothstep(lensRadius.x, lensRadius.y, dist),2.);
51+
52+
rnd *= .025*vigfin+d.rg*FROSTYNESS*vigfin;
53+
uv += rnd;
54+
fragColor = mix(texture(image, uv),vec4(COLOR_RGB,1.0),COLORIZE*vec4(rnd.r));
55+
}
56+
```

0 commit comments

Comments
 (0)