added chromatic aberration

This commit is contained in:
Valerie Wolfe 2024-04-18 00:22:26 -04:00
parent 6721e66bf4
commit 623a7e4645
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
- Chromatic Aberration
- Color depth reduction
- Depth of Field
- Dithering

View file

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

View file

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

View file

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

View file

@ -24,6 +24,7 @@ option.satSteps=Saturation Depth
option.valSteps=Value Depth
screen.SCREEN=Screen
option.aberration=Chromatic Aberration
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 effects
screen.SCREEN=<empty>
screen.SCREEN=aberration
# console effects
screen.CONSOLE.columns=1