# Aberration

In real life we have a couple of abberations, such as Optical aberration, Aberattion of light, Relativistic aberration(0).
Aberration of light, also known as astranomical-stellar aberration relates to space objects,  which produces an apparent motion of celestial objects about their locations dependent on the velocity of the observer. So we defenitely doesn’t need this in classic shooter game. Relativistic aberration refers to accepted physical regarding the relationship between space and time, wich refers to Einstein’s special theory of relativity(1). It’s very interesting btw…

Optical abberation also have several variations but we will implement the simple Chromatic aberration(2).

In the real world it occurs when a cheap lens is used with a short focal point. Light of different wavelengths focus at different distances making it hard to get a fully sharp image, and you end up with color bleeding.

In games it usually appears in action moments. We have 3 chanells, one of them will be the same and two will have a small offset wich we can control.

Texture2D t_frame; // : register( t0 );

static const float aberration_r = aberration_parameters.x; //control amount of red color channel
static const float aberration_b = aberration_parameters.y; //control amount of blue color channel

float screen; //screen resolution
float2 uv; // uv coord
float3 fColor; // color or the frame
float2 uv_offset = uv - 0.5f; // main offset

float2 uv_offset_left = uv_offset * ( 1.0 + aberration_red * screen.z ) + 0.5;
float2 uv_offset_right = uv_offset * ( 1.0 - aberration_blue * screens.w ) + 0.5;

frame = float3(
t_frame.Sample( sampler, uv_offset_left, 0 ).r,
t_frame.Sample( sampler, uv, 0 ).g,
t_frame.Sampl( sampler, uv_offset_right, 0 ).b
);