added chromatic aberration

This commit is contained in:
Valerie Wolfe 2024-04-18 00:22:26 -04:00
parent 12b71f2bb9
commit 9edd7782c6
8 changed files with 32 additions and 7 deletions

View file

@ -5,6 +5,7 @@ aimed at providing a variety of effects in the vein of its parent project.
## Features ## Features
- Chromatic Aberration
- Color depth reduction - Color depth reduction
- Depth of Field - Depth of Field
- Dithering - Dithering

View file

@ -1,6 +1,7 @@
#version 120 #version 120
#define pixelSize 2 // the size of pixels [1 2 4 8 16] #include "/module/common.glsl"
float renderRes = pixelSize; float renderRes = pixelSize;
#define dithering // whether or not to apply dithering #define dithering // whether or not to apply dithering

View file

@ -1,6 +1,8 @@
#version 120 #version 120
#define pixelSize // [1 2 4 8 16] #include "/module/common.glsl"
//#define aberration
//#define hBlur //#define hBlur
varying vec2 texcoord; varying vec2 texcoord;
@ -8,14 +10,21 @@ varying vec2 texcoord;
uniform sampler2D gcolor; uniform sampler2D gcolor;
uniform float viewWidth; uniform float viewWidth;
#include "/module/aberration.frag"
#include "/module/horizontal_blur.frag" #include "/module/horizontal_blur.frag"
void main() { void main() {
vec3 color;
#ifdef hBlur #ifdef hBlur
vec3 blurred = hblur(); color = hblur();
gl_FragData[0] = vec4(blurred, 1);
#else #else
gl_FragData[0] = texture2D(gcolor, texcoord); color = texture2D(gcolor, texcoord).rgb;
#endif #endif
#ifdef aberration
color.rb = aberrate().rb;
#endif
gl_FragData[0] = vec4(color, 1);
} }

View file

@ -1,6 +1,6 @@
#version 120 #version 120
#define pixelSize 2 // [1 2 4 8 16] #include "/module/common.glsl"
#define worldCurvature 0 // [0 1 2] #define worldCurvature 0 // [0 1 2]

View file

@ -24,6 +24,7 @@ option.satSteps=Saturation Depth
option.valSteps=Value Depth option.valSteps=Value Depth
screen.SCREEN=Screen screen.SCREEN=Screen
option.aberration=Chromatic Aberration
screen.CONSOLE=Consoles screen.CONSOLE=Consoles

View file

@ -0,0 +1,10 @@
vec2 caOffset = vec2(pixelSize / viewWidth, 0);
vec3 aberrate() {
float red = texture2D(gcolor, texcoord - caOffset).r;
float blue = texture2D(gcolor, texcoord + caOffset).b;
return vec3(red, 0, blue);
}

View file

@ -0,0 +1,3 @@
#define pixelSize 2 // [1 2 4 8 16]

View file

@ -17,7 +17,7 @@ screen.COLOR.columns=3
screen.COLOR=colorMode dithering <empty> rgbSteps <empty> <empty> hueSteps satSteps valSteps screen.COLOR=colorMode dithering <empty> rgbSteps <empty> <empty> hueSteps satSteps valSteps
# screen effects # screen effects
screen.SCREEN=<empty> screen.SCREEN=aberration
# console effects # console effects
screen.CONSOLE.columns=1 screen.CONSOLE.columns=1