# Compositor setting in Blender Internal: How to properly make a split RGB effect on further objects using Z?

I'm a blender amateur, I've learned it by myself, and I was trying to make a split RGB effect on the objects that are the further away from the camera. I tested it out with this simple scene:

In the compositor, I tried to shift the R and B layers depending on the Z value. For example, Z=4 on the closest cube and Z=14 on the furthest one. I thought then that I could multiply it by 5 so the R channel could move 20 or 70 pixels to the left. But it didn't give me the result I expected.

Here a screenshot of my node setting:

And this is what I get:

This is what I'm trying to have: Here, the focus is on the woman face and everything that is before or after is not blurry but splitted. I'd to do this but with the R and B layers.

First of all, is it even possible and if so, how can I ^^? Thank you in advance for your help! :)

One challenging aspect of this effect is that the strength of the color shift increase with the distance from the object that is in focus. This is solved in the compositor by using the depth and a user supplied distance that is considered in focus, to calculate the intensity of the applied color shift.

Before

After

Unfortunately the color shift produces artifacts at the image border. Cropping by the number of shifted pixels may be necessary for good looking results. The proper solution would be to mirror the image along the borders before performing the shift to avoid artifacts in the border region.

Cropped

The Depth Color Shift node setup uses the normalized depth as input to the Gaussian function. This allows to have a nice spread of the intensity values instead of a sharp peak for the depth that is in focus. The output is normalized and inverted, since the effect is supposed to be the smallest at the given depth.

The Gauss Function implements the Gaussian function.

The Shift Color shifts both the individual color channels and the intensity values. The latter is used as blending factor to ensure that the effect strength is applied correctly depending on the distance.

The parameters of the Depth Color Shift node are:

• Focus Distance: Distance where the effect is the weakest (is used as $$μ$$ in the Gaussian function)
• $$σ$$: Parameter of the Gaussian function, controls the variance
• R Shift X: Shift of the red color channel along the x-axis
• R Shift Y: Shift of the red color channel along the y-axis
• G Shift X: Shift of the green color channel along the x-axis
• G Shift Y: Shift of the green color channel along the y-axis
• B Shift X: Shift of the blue color channel along the x-axis
• B Shift Y: Shift of the blue color channel along the y-axis

The Intensity output of the Depth Color Shift node allows you to see the strength of the effect (black = no strength, white = full strength)

The example file below is for Blender 2.80, however the same node setup should work in 2.79 as well.

• Great answer to the OP .. just my 2¢.. of the 2 types of chromatic aberration , maybe transverse is already catered for by the Lens Distortion node > Dispersion? (Controlled by a vignette,not depth). This is more like axial c.a, a failure of wavelengths to focus on the same plane. Maybe you could deferentially control blurring of R,G,and B, using your Gaussian node group, rather than shifting? On the other hand, maybe we're not looking for a simulation at all, just a style. – Robin Betts Oct 30 '19 at 20:31
• I think this is purely a stylistic choice made in Spiderman: Into the Spider-Verse. If it is indeed based on physical lens properties (rather than the color misprints in comics) then it would be axial chromatic aberration. I've tested the dispersion of the Lens Distortion node and the increased strength towards the edges and the distortion do not match the reference as far as I can tell. Therefore I didn't try to recreate a transverse chromatic aberration effect. – Robert Gützkow Oct 30 '19 at 20:53