mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 22:09:28 -07:00
All non-trivial shaders are now loaded from files.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform float width, height;
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 direction;
|
||||
|
||||
varying vec2 vUV;
|
||||
|
||||
void main() {
|
||||
vec2 size = width > height ? vec2(width / height, 1.) : vec2(1., height / width);
|
||||
gl_FragColor =
|
||||
@@ -11,14 +14,4 @@ void main() {
|
||||
texture2D(tex, vUV + direction / max(width, height) * size) +
|
||||
texture2D(tex, vUV - direction / max(width, height) * size)
|
||||
) * 0.279;
|
||||
// gl_FragColor =
|
||||
// texture2D(tex, vUV) * 0.38774 +
|
||||
// (
|
||||
// texture2D(tex, vUV + direction / max(width, height) * size * 0.5) +
|
||||
// texture2D(tex, vUV - direction / max(width, height) * size * 0.5)
|
||||
// ) * 0.24477 +
|
||||
// (
|
||||
// texture2D(tex, vUV + direction / max(width, height) * size) +
|
||||
// texture2D(tex, vUV - direction / max(width, height) * size)
|
||||
// ) * 0.06136;
|
||||
}
|
||||
20
shaders/glsl/bloomPass.combine.frag.glsl
Normal file
20
shaders/glsl/bloomPass.combine.frag.glsl
Normal file
@@ -0,0 +1,20 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D pyr_0;
|
||||
uniform sampler2D pyr_1;
|
||||
uniform sampler2D pyr_2;
|
||||
uniform sampler2D pyr_3;
|
||||
uniform sampler2D pyr_4;
|
||||
uniform float bloomStrength;
|
||||
|
||||
varying vec2 vUV;
|
||||
|
||||
void main() {
|
||||
vec4 total = vec4(0.);
|
||||
total += texture2D(pyr_0, vUV) * 0.96549;
|
||||
total += texture2D(pyr_1, vUV) * 0.92832;
|
||||
total += texture2D(pyr_2, vUV) * 0.88790;
|
||||
total += texture2D(pyr_3, vUV) * 0.84343;
|
||||
total += texture2D(pyr_4, vUV) * 0.79370;
|
||||
gl_FragColor = total * bloomStrength;
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
precision mediump float;
|
||||
varying vec2 vUV;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float highPassThreshold;
|
||||
|
||||
varying vec2 vUV;
|
||||
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, vUV);
|
||||
if (color.r < highPassThreshold) color.r = 0.0;
|
||||
Reference in New Issue
Block a user