July 1, 2015

Unity3D Anaglyph Construction Kit

Freddy Lives!

You don’t care about all this bla bla bla? FINE, HERE YOU GO: http://github.com/EsimpleStudios/Unity3D-Anaglyph-izer <<– GET IT HEREE!!!

If you like this package, don’t forget to visit our Facebook page *HINT Like it ENDOFHINT*

Unity3D official forum link: http://bit.ly/aSFjUH


Released the 1.2 version of the package, same URL you can find up there.

WHAT’S NEW (1.2)

– there’s no need anymore to link the various shaders
– included a single parametric shader
– it’s now possible to create an infinite number of materials adjustable with parameters (see below) included configurations for Magenta/Green and Red/Blue modes
– added a “Use Projection Matrix” flag to optimize the focal distance based on the camera’s Field of View
– changed the folder structure to be more “Unity-friendly”
– added a fancy Demo (ONLY 3.x) that we promise will make you jump from your chair. It’s already packed in the “With_Demo” package and available as a project in the Assets/Demo folder

Huge change in 1.2!

So what’s this big change we talked about?
Practically, we introduced one parametric shaders which allows you to create any kind of material optimized for any kind of anaglyph matrix, like you can see here.

Here are the matrixes for the main anaglyph modes.

True Anaglyphs

  • Dark image
  • No color reproduction
  • Little ghosting

Gray Anaglyphs

  • No color reproduction
  • More ghosting than true anaglyphs

Half Color Anaglyphs

  • Partial color reproduction (but not as good as color anaglyphs)
  • Less retinal rivalry than color anaglyphs

Optimized Anaglyphs

  • Partial color reproduction (but not of red shades)
  • Almost no retinal rivalry

Matrix settings

Balance Left Red = (r, g, b, not_used)
Balance Left Green = (r, g, b, not_used)
Balance Left Blue = (r, g, b, not_used)

Balance Right Red = (r, g, b, not_used)
Balance Right Green = (r, g, b, not_used)
Balance Right Blue = (r, g, b, not_used)

For example, if we want to obtain the Optimized Anaglyph material we have to setup the matrix like this:

Balance Left Red (0.0, 0.7, 0.3, any)
Balance Left Green (0.0, 0.0, 0.0, any)
Balance Left Blue (0.0, 0.0, 0.0, any)

Balance Right Red (0.0, 0.0, 0.0, any)
Balance Right Green (0.0, 1.0, 0.0, any)
Balance Right Blue (0.0, 0.0, 1.0, any)

According to the diagram shown up there.

Example for the Green/Magenta Color

Balance Left Red (0.0, 0.0, 0.0, any)
Balance Left Green (0.1, 0.0, 0.0, any)
Balance Left Blue (0.0, 0.0, 0.0, any)

Balance Right Red (0.0, 1.0, 0.0, any)
Balance Right Green (0.0, 0.0, 0.0, any)
Balance Right Blue (0.0, 0.0, 1.0, any)

Example for the Green/Magenta Optimized

Balance Left Red (0.0, 0.0, 0.0, any)
Balance Left Green (0.0, 0.7, 0.3, any)
Balance Left Blue (0.0, 0.0, 0.0, any)

Balance Right Red (0.0, 1.0, 0.0, any)
Balance Right Green (0.0, 0.0, 0.0, any)
Balance Right Blue (0.0, 0.0, 1.0, any)

All the story

So, the facts, straight from Wikipedia:

“Anaglyph images are used to provide a stereoscopic 3D effect, when viewed with 2 color glasses (each lens a chromatically opposite color, usually red and cyan). Images are made up of two color layers, superimposed, but offset with respect to each other to produce a depth effect. Usually the main subject is in the center, while the foreground and background are shifted laterally in opposite directions. The picture contains two differently filtered colored images, one for each eye. When viewed through the “color coded” “anaglyph glasses”, they reveal an integrated stereoscopic image. The visual cortex of the brain fuses this into perception of a three dimensional scene or composition.” – source http://en.wikipedia.org/wiki/Anaglyph_image

With the boom of 3D movies in theaters, and due to the (still) kinda high costs of polarized 3D TV solutions, we have seen a sudden rebirth of the anaglyph technique, mainly to cause a “Woah” effect on customers.
The problem? Well let’s be honest, this poor man’s 3D so far has been applied to crap. Yeah I don’t use this word often but quite frankly, when I see famous magazines coming out with bleeding edge anaglyph inserts, I die a little inside.

So while we were working on our usual Unity3D stuff, something happened…

Everything started from this forum post.

We took the script posted by aNTeNNa trEE of the Unity Demo Team.
We added the modification posted by Monark implementing the projection matrix method, to simplify vision for the eyes.
Monark also posted a modified shader from the original one, which we included by default.

Then, we cooked all our modifications and we finally decided to release it under GPL for everyone to enjoy.

If you are even remotely like us, you’ll spend hours firing at stuff in the bootcamp demo like idiots.

Look, if this looked “so and so”, I’d be the first one to say. Heck I don’t even know how to launch Unity3D, YES shocking news!
But, this impressed me. The best part was to try it with the vintage, hardcore Freddy Krueger’s 3D glasses, just to get an idea how old this “wow factor” really is.


ONLY FOR 2.6.1: replace the shader in the package with the correct version in the source/Shaders/2.6.1 folder

  1. Link the AnaglyphizerJ.Js (Javascript) or AnaglyphizerC.Cs (C#) to the camera. Or Select Camera and Open Component -> Anaglyphizer -> Anaglyphizer(Cs or Js)
  2. Link your material or one of those included in the prefab folder to the script

Inspector variables to change script parameters:

Use Projection Matrix -> Flag

Improve correct lens calculation based on Field Of View parameter

WARNING: it’s the first time we release a package like this. If we screwed something up, let us know. If the README sounds lame, let us know. If it doesn’t work for you, let us know. Well you got the point. Just comment down here and we’ll be happy to answer.


  1. Randy@Commercial Solar
    Twitter: http://www.socoreenergy.com/

    that is pretty awesome, i been looking at this a little bit and it is pretty interesting stuff. thanks for putting out a diy solution.

  2. rahu ketulya says:

    Hi there,

    Can you implement something for active stereoscopy. Like quad buffer stereo 3D?


  3. bhaktaraj says:

    hi bro u r da most coolest guy bro thanks for the tool it is really awesome five star for u ***** :)