# glsl-chromatic-aberration

> glslify function for approximating chromatic aberration

Latest version **1.0.1** (published 2018-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install glsl-chromatic-aberration
pnpm add glsl-chromatic-aberration
yarn add glsl-chromatic-aberration
bun add glsl-chromatic-aberration
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-08-21 |
| First published | 2018-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | JohH |
| Maintainers | johh |
| Keywords | glsl, shader, webgl, stackgl, glslify, shaders, chromatic, aberration, color, purple, fringing, post, processing |

## Links

- npm: https://www.npmjs.com/package/glsl-chromatic-aberration
- Repository: https://github.com/DOWNPOURDIGITAL/glsl-chromatic-aberration
- Issues: https://github.com/DOWNPOURDIGITAL/glsl-chromatic-aberration/issues
- npm.io page: https://npm.io/package/glsl-chromatic-aberration

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-08-21
- 1.0.0 — 2018-08-21

## README

# glsl-chromatic-aberration

[glslify](https://github.com/glslify/glslify) module for fast approximation of chromatic aberration as a post processing (fullscreen) effect.

The function shifts each RGB channel separately in the given direction.

Combine with a [directional blur](https://github.com/Jam3/glsl-fast-gaussian-blur) pass for more convincing results.

## Installation
[glslify](https://github.com/glslify/glslify) is required for importing.

```
yarn add glsl-chromatic-aberration
```
```
npm i glsl-chromatic-aberration --save
```

## Usage
```glsl
vec4 ca( sampler2D image, vec2 uv, vec2 resolution, vec2 direction )
```
The function shifts each RGB channel of **`image`** separately in the given **`direction`** and returns the color for the pixel at **`uv`**.

## Example
```glsl
#pragma glslify: ca = require('glsl-chromatic-aberration')

uniform vec2 iResolution;
uniform sampler2D iChannel0;

void main() {
  vec2 uv = gl_FragCoord.xy / iResolution;
  vec2 direction = ( uv - .5 ) * 10.0;
  
  gl_FragColor = ca( iChannel0, uv, iResolution.xy, direction );
}	
```

---
_Source: https://npm.io/package/glsl-chromatic-aberration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
