-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrender2DTex.frag
More file actions
35 lines (30 loc) · 877 Bytes
/
Copy pathrender2DTex.frag
File metadata and controls
35 lines (30 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#version 300 es
precision highp float;
uniform float uT;
uniform float uTModded;
uniform float uDT;
uniform float uGamma;
uniform vec2 uWindowSize;
uniform vec2 uMouse;
uniform sampler2D uTex;
in vec2 vTexCoord;
out vec4 color;
//note: uniformly distributed, normalized rand, [0;1[
float nrand(vec2 n) {
return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);
}
float n1rand(vec2 n) {
float t = fract(uTModded);
float nrnd0 = nrand(n + 0.07 * t);
return nrnd0;
}
void main () {
// vec4 c = texture(uTex, vTexCoord);
// c.xyz += n1rand(vTexCoord);
// vec4 v = texture(uTex, vTexCoord);
// vec4 c = v * 1./texture(uTex, vec2(vTexCoord.x * .25, vTexCoord.y)) * 1.;
// vec4 c = v * exp(vTexCoord.x * 7.5) * 100000000.;
// c.xyz = pow(c.xyz, vec3(1.0/2.2));
vec3 c = pow(texture(uTex, vTexCoord).xyz, vec3(1. / uGamma));
color = vec4(c, 1.);
}