mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-21 07:19:30 -07:00
Gouging a simpler project out of the larger project.
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
precision mediump float;
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D bloomTex;
|
||||
uniform sampler2D backgroundTex;
|
||||
varying vec2 vUV;
|
||||
|
||||
vec4 getBrightness(vec2 uv) {
|
||||
vec4 primary = texture2D(tex, uv);
|
||||
vec4 bloom = texture2D(bloomTex, uv);
|
||||
return primary + bloom;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 bgColor = texture2D(backgroundTex, vUV).rgb;
|
||||
|
||||
// Combine the texture and bloom, then blow it out to reveal more of the image
|
||||
vec4 brightness = getBrightness(vUV);
|
||||
|
||||
gl_FragColor = vec4(bgColor * (brightness.r + brightness.g * 2.0), 1.0);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
precision mediump float;
|
||||
varying vec2 vUV;
|
||||
uniform float aspectRatio, cameraAspectRatio;
|
||||
uniform float time;
|
||||
uniform vec3 clicks[5];
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D bloomTex;
|
||||
uniform sampler2D cameraTex;
|
||||
|
||||
void main() {
|
||||
|
||||
float intensity = 0.0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
vec3 click = clicks[i];
|
||||
float distanceToClick = length((click.xy - vUV) * vec2(aspectRatio, 1.0));
|
||||
float elapsedTime = clamp(time - click.z, -100.0, 100.0);
|
||||
float t = distanceToClick - elapsedTime * 0.5;
|
||||
intensity += sin(t * 40.0) / t;
|
||||
}
|
||||
intensity *= 0.2;
|
||||
|
||||
vec2 uv = vUV + intensity * 0.001;
|
||||
|
||||
float webcamAspectAdjust = cameraAspectRatio / aspectRatio;
|
||||
vec2 webcamTransform = vec2(1.0, webcamAspectAdjust);
|
||||
if (webcamAspectAdjust > 1.0) {
|
||||
webcamTransform = vec2(1.0 / webcamAspectAdjust, 1.0);
|
||||
}
|
||||
vec2 webcamUV = ((uv - 0.5) * webcamTransform) + 0.5;
|
||||
|
||||
vec3 webcam = texture2D(cameraTex, 1.0 - webcamUV).rgb;
|
||||
webcam *= mix(vec3(0.1, 0.3, 0.0), vec3(0.9, 1.0, 0.7), 1.0 - length(vUV - 0.5) * 1.5);
|
||||
|
||||
vec3 code = mix(webcam, vec3(0.7, 1.0, 0.4), texture2D(tex, uv).r * (1.0 + intensity * 0.3) + texture2D(bloomTex, uv).r * 0.5);
|
||||
|
||||
gl_FragColor = vec4(code, 1.0);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
precision mediump float;
|
||||
uniform sampler2D quiltTexture;
|
||||
uniform float pitch;
|
||||
uniform float tilt;
|
||||
uniform float center;
|
||||
uniform float invView;
|
||||
uniform float flipImageX;
|
||||
uniform float flipImageY;
|
||||
uniform float subp;
|
||||
uniform float tileX;
|
||||
uniform float tileY;
|
||||
uniform vec2 quiltViewPortion;
|
||||
varying vec2 vUV;
|
||||
|
||||
vec2 texArr(vec3 uvz) {
|
||||
float z = floor(uvz.z * tileX * tileY);
|
||||
float x = (mod(z, tileX) + uvz.x) / tileX;
|
||||
float y = (floor(z / tileX) + uvz.y) / tileY;
|
||||
return vec2(x, y) * quiltViewPortion;
|
||||
}
|
||||
|
||||
float remap(float value, float from1, float to1, float from2, float to2) {
|
||||
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 rgb[3];
|
||||
vec3 nuv = vec3(vUV.xy, 0.0);
|
||||
|
||||
// Flip UVs if necessary
|
||||
nuv.x = (1.0 - flipImageX) * nuv.x + flipImageX * (1.0 - nuv.x);
|
||||
nuv.y = (1.0 - flipImageY) * nuv.y + flipImageY * (1.0 - nuv.y);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
nuv.z = (vUV.x + float(i) * subp + vUV.y * tilt) * pitch - center;
|
||||
nuv.z = mod(nuv.z + ceil(abs(nuv.z)), 1.0);
|
||||
nuv.z = (1.0 - invView) * nuv.z + invView * (1.0 - nuv.z);
|
||||
rgb[i] = texture2D(quiltTexture, texArr(vec3(vUV.x, vUV.y, nuv.z)));
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(rgb[0].r, rgb[1].g, rgb[2].b, 1);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
precision mediump float;
|
||||
#define PI 3.14159265359
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D bloomTex;
|
||||
uniform sampler2D stripeTex;
|
||||
uniform float ditherMagnitude;
|
||||
uniform float time;
|
||||
uniform vec3 backgroundColor, cursorColor, glintColor;
|
||||
uniform float cursorIntensity, glintIntensity;
|
||||
varying vec2 vUV;
|
||||
|
||||
highp float rand( const in vec2 uv, const in float t ) {
|
||||
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
||||
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
||||
return fract(sin(sn) * c + t);
|
||||
}
|
||||
|
||||
vec4 getBrightness(vec2 uv) {
|
||||
vec4 primary = texture2D(tex, uv);
|
||||
vec4 bloom = texture2D(bloomTex, uv);
|
||||
return primary + bloom;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 color = texture2D(stripeTex, vUV).rgb;
|
||||
|
||||
vec4 brightness = getBrightness(vUV);
|
||||
|
||||
// Dither: subtract a random value from the brightness
|
||||
brightness -= rand( gl_FragCoord.xy, time ) * ditherMagnitude / 3.0;
|
||||
|
||||
gl_FragColor = vec4(
|
||||
color * brightness.r
|
||||
+ min(cursorColor * cursorIntensity * brightness.g, vec3(1.0))
|
||||
+ min(glintColor * glintIntensity * brightness.b, vec3(1.0))
|
||||
+ backgroundColor,
|
||||
1.0
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user