added chromatic aberration and prepared restructoring by moving 2d filter to Image-Filtering

This commit is contained in:
Sven Vogel 2023-06-30 11:19:43 +00:00
parent d37a61875e
commit b90f60c7da
4 changed files with 36 additions and 3 deletions

24
Image.glsl Normal file
View File

@ -0,0 +1,24 @@
const float Samples = 4.;
const float Strength = 0.085; // 2.5%
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord/iResolution.xy-.5;
vec3 col = vec3(0);
vec3 f = 1. - length(uv) * Strength*vec3(2.,1.,0.);
for (float i = 0.; i < Samples; i++)
{
vec3 fs = mix(f, vec3(1), i/Samples);
col += vec3(
texture(iChannel0, uv * fs.x+.5).r,
texture(iChannel0, uv * fs.y+.5).g,
texture(iChannel0, uv * fs.z+.5).b
);
}
col /= Samples;
fragColor = vec4(col,1.0);
}

View File

@ -1,3 +1,7 @@
# Shadertoy-Shaders
Repository for every shader I've written for shadertoy
# Image-Filtering
## About
This folder contains various filter that can be applied to 2D images. Every shader is written in GLSL and is supposed to deliver a simple
handson sample implementation. With some filters even implementing some optimization measures such as quicker blurs or magic numbers instead of constant functions.
## Content
- Bilateral Filter
- Chromatic Aberration

5
READMME.md Normal file
View File

@ -0,0 +1,5 @@
# Chromatic-Aberration
![overview.png](https://git.teridax.de/teridax/Shadertoy-Shaders/raw/branch/main/Chromatic-Aberration/overview.png)
This is a crude implementation of a 2D filter mimicing the effect of chromatic aberration which happens with real world lenses
that are unable to focus light of different wavelengths to the same focal plane.

BIN
overview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB