Tag Archives: Gamma

Plugins & Scripts for After Effects at AEScripts.com

It has been for a while now, but I haven’t made an official announcement about it until now. So in case you haven’t notice yet, most of my Pixel Bender filter for After Effects are available on Lloyd Alvarez’s website which is called AEScripts.com. (But There are still all open source and you can name your own price 😉 )

AEScript is a great place to find many different kind of scripts or filters which can make your life easier on a every day basis. I would encourage you to go through all the scripts & filters list to see what exists. Because you might not need all them right now, but most of it have been made to solve problem people encounter with AE, so being aware that a script exists somewhere in case one day you have an issue with After Effect is a great knowledge for a user 🙂

As for today several filters and one script which I made are available there, but again check all the other ones as well, there are all incredible!

  • ft-Toolbar : create your own tool bar to apply Effects, presets, scripts, … in ONE click !
  • ft-CombineRGBA : let you swap channels or combine them from two different sources in 32bpc
  • ft-Cubic Lens Distortion : (un)distort your footage with a lot of accuracy using Syntheyes algorithm. Add or erase Chromatic Aberration as well
  • ft-Brightness Check : show you if pixels are too bright or dark in your comp, great to check if it “Broadcast-safe”
  • ft-Technicolor : mimic a 2-strip & 3-strip technicolor process
  • ft-Filmic Contrast : a one click contrast filmic looking using Perlin Gain.
  • ft-UVPass : re-texture directly in After Effect
  • ft-Clamp : clamp pixels value between defines one. Perfect to solve blending mode issue with 32bpc comp
  • ft-PPass2Matte : use a Point Pass to create 3d masks
  • ft-Auto White Balance : color balance in one click footages which had a bad white balance at the shooting time
  • ft-Vignetting : add a vignette effect to your comp

Please if you use them, let me know or post comment, show us what you did with it 🙂

Pixel Bender : “ft-Filmic Contrast” for After Effects


A one slider plugin that gives a very compelling filmic contrast “look” to your footage.  Partially based on Ken’s Perlin Gain function & Roy Stelzer’s presentation

Download & Sources

How to install it ?

Just copy the .pbk file into your “Support Files” folder in your AE install directory


Color Grading with Blender 2.5


Yeahh Matt Ebb just commit my patch (SVN r27733) for the “Color Balance” node in Blender 2.5 Compositing node !!! Now it should be much easier to work with.

You can get a version of blender at Graphicall.org (any version above revision 27733)

There is still some precision issue on the color wheels, I guess some day it will be possible to move the color picker slower.

How to use it ?

First I would recommend you to un-check the “color management” setting in Blender 2.5 or it will make the blacks really hard to control.

If you are not so familiar with color grading, and push-pull techniques, I would really recommend you to watch Stu Maschwitz’s (Prolost) video tutorial using Magic Bullet Colorista. The settings won’t be exactly the same, but the approach quite the same though !

Red Giant TV Episode 22: Creating a Summer Blockbuster Film Look from Stu Maschwitz on Vimeo.

How does it works ?

I described the Lift/Gamma/Gain in a previous post, and mostly this node is based on the formulas specified there. We just slightly modified it so the 3 defaults values parameters are equal to 1.0 just like in Colorista. Which makes it much easier to control the blacks.
Actually the “Color Balance” node before this revision was the same formula but with lift default value equal to 0.0

Some presets !

While making some comparison test between Colorista in After Fx and the “color balance” node in blender, I tried to mimic some of Colorista’s presets.
You can download the “Blender Color Grading Presets” here : http://code.google.com/p/ft-projects/downloads/list

There is the following presets :

Bleach preset w/ Color Balance node
Cold preset w/ Color Balance node
Cool to Warm preset w/ Color Balance node
Day to Night preset w/ Color Balance node
Punchy preset w/ Color Balance node

vignetting using Mike Pan's approach

Understanding Gamma and Linear workflow

Even If I’m aware of what gamma and Linear workflow is, I’m not quite sure I’m using it always in the correct way. So I decide to dive into documentations and forums again to refresh my memory about it and at the same time closing a few gap.
Since so many people, even in the industry, still don’t know what it is and how it works, I thought I would make kind of a dairy of what I found on with my research those couple days.


To get started, there is this great example from AEtuts+.com talking about Linear workflow in AE. It is not a the deepest explanation out there, but it will give you a nice overview with simple words and explicit example of what Linear workflow is and why it is so important !

So after that, 5 points you should keep in mind about Gamma (from Gamma 101 on mymentalray.com)

  1. Most displays have a non-linear response to pixel values.
  2. Most graphics software are written for a linear color model, i.e. they make the simple assumption that 255 is twice as bright as 128. But since the monitor is non-linear, this is not true. In fact, for most monitors (with a gamma=2.2), you need to send the pixel value (0.5^(1/2.2))*255=186 if you want 50% of the brightness of 255. The commonly used value of 128 will only produce about (128/255)^2.2 = 22% brightness.
  3. Digital cameras have a (roughly) linear response to light intensity, but since they are intended for display on computer monitors, they embed the non-linearity (gamma) in the image. (True for .jpg, whereas RAW files are just that – RAW, i.e. linear data, that gets non-linear when converted to JPG, for example)
  4. Therefore, if you input .jpg images taken with a camera into a graphics software, you need to compensate for the images gamma. (by inverse gamma. 1/2.2 = 0.455)
  5. And if you display the (linear) data generated from a graphics algorithm, you need to compensate for the display gamma. (add 2.2 gamma to the picture)

A few facts :

When creating a texture in Photoshop, you’ll see its color with 2.2 gamma applied (Because screens are big liar :p). Meaning when you think you got the good “brightness”, you actually made it twice (or more) brighter than what it’s supposed to be in real world.
When for painting, or montage it might not be import, for texture it is really important !!! Because as said above, your renderer/shader/… will assume the picture is linear and will apply math according to that.
So the only solution to bring this picture back to a “linear color space” is to set the gamma to the inverse of what the monitor shows you. As we know on PC, gamma are shown as 2.2 (I think it’s 1.8 on mac OSX). So the gamma value of your texture before saving it should be 0.455 (1/2.2).

Tips : In Photoshop, on top of your layer, add a “Level Adjustment Layer” and set the gamma value (mid-tone) to 0.455

With most today software I don’t think it is necessary to do that any more, but to be honest, this really depends on how the software you are using integrate Linear Workflow. For instance in 3Ds Max you can enable the Gamma correction in the “Gamma and LUT” tab of the preferences panel.

Because renders works in Linear space, your rendering would seems to look darker on your screen. So in case you are saving it to a 8bits type file (as JPG), you should set the output gamma parameter to 2.2. But in case you are saving  it to a floating point file (HDR, RAW, EXR, …), this parameter should remain 1.0. Because all the dynamics of your picture is saved in those raw file, you would apply the Gamma only in post process (compositing).

In the above case with After Effects, by making sure to activate the linear space workflow, it should take care of that for you, so you don’t have to change gamma to anything, just leave it.

Links :

Mental Ray Linear Workflow from chad smashley on Vimeo.

Here some nice read :

Blender Quick Tips : How to create masks in the compositing editor

Since there is no mask in the “Compositing Editor” of Blender yet, I found a simple tricks which could work pretty well especially in case of color grading.

You’ll see nothing really fancy here since the mask can only be square (or pretty close to a square shape though). But if you check out Colorista for instance, the two allowed shapes are ellipse and rectangle.

Blender Quick Tips : How to create masks in the compositing editor from François Tarlier on Vimeo.

Blender 2.5 – Color Management and linear workflow

I’ve been waiting for this since ever ! Blender 2.5 is managing linear workflow (gamma correction, … ).
Matt Ebb just did a great update where the UI (color picker, …) give you feedback of linear color and present the linear workflow.


Here is the comment of the SVN update (revision 25065) :

Changes to Color Management

After testing and feedback, I’ve decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.

This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you’re doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.

This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we’re set on changing other areas of shading,
this won’t be too disruptive overall.

Check out the documentation on the wiki here : http://www.blender.org/development/release-logs/blender-250/color-management

Exposure/Offset/Gamma photoshop tool to Shaders

The goal here was to understand how works the Exposure feature of Photoshop for my research on lift/gamma/gain


NB : I wouldn’t say I’m an 100% sure about how it works, but that’s how I understood it worked so far

Exposure :

I though exposure was more complicated than that (maybe it is) but the way I’m reproducing it, is only by adding a percentage of the pixel by himself. nothing more complicated than that.

Offset :

As seen in my previous post, the Offset is just an Add of a value. My first approach on it was saying Offset is controlling the luminance of it, so I guess the correct way would be to convert the pixel in the YCbCr color space, add a value to the Y channel, and reconverting back to RBG color space. But this is doing a lot of calculation for nothing, while adding just a value to the entire picture would probably do the same, and actually would correspond to the Lift (or Offset of the CDL).
Plus switching between color space makes you loose some tiny precision in the color.

Anyway, I’ll give the two solutions, please let me know if you think one is better than the other

Gamma :

As usual, power(1/gamma)

The right order :

If all this was actually all pretty simple, at least I learned one thing (obvious as well I must say). Don’t forget to do the operation in the right order. In my first try I had a small bug, and couldn’t have the same result in Photoshop & in my shader, because I was doing the offset before the exposure. Which is pretty silly, since if you do that, you are loosing all the dynamic range of your picture when you actually want to have as much information as you can for your exposure.

The order is Exposure -> Offset -> Gamma.

Formula :

output = ((input*exposure) + offset)^(1/gamma)

hum… looks a lot like the CDL formula doesn’t it ? 🙂 Except exposure is a single float value between 0 and 20 ? (maybe more, maybe less depends of your picture)and the default value should be 1.The offset should be between -10 ? and 1 I think.

Shaders (HLSL in Media Player Classic) :


Here I’m giving the version with YCbCr conversion, but I’m pretty sure it is not doing anything more than the above one, except loosing information in conversion. But at least it shows the YCbCr conversion 🙂


lift/gamma/gain VS. ASC CDL

Following my previous post “lift-gamma-gain color correction formula with blender compositing” I continue my research about all those formulas.


I came to compare the ASC CDL (American Society of Cinematographers Color Decision List) formula to the Lift/Gamma/Gain formula I found on Blender.org

Here are the results :



Where the formula are :

  • CDL : ((input*slope)+offset)^(1/gamma)
  • Lift :  gain * (input + lift * (1 – input)^(1/gamma))

(slope = gain ; offset = lift)

You can see that CDL is able to burn (exposure) the white, while the Lift will keep the white unchanged as much as it can.
_dbr did a nice test for me in Shake and create a graph that really shows the differences


so in both formula by only changing Lift/Offset, you can see clearly that the lift keep the white unchanged while CDL push the black and white as well.

HLSL Shader in Media Player Classic

Yes, in Media Player Classic, you can write shaders compiled in runtime while you are watching your favourite TV Shows ^^ . Awesome !!!

hlsl code on Pasteall.org


So I guess CDL is much easier to use, but I believe that Lift could give you much control other the image. What would need Lift to be able to push the white as well would be an exposure parameter! (which is the goal of my next shader 🙂 )

lift-gamma-gain color correction formula with blender compositing

I got lately interest in Lift/Gamma/Gain formula for some personal project, I thought I would share some of the informations I found.

What does Lift/Gamma/Gain ?

Lift/Gamma/Gain is actually is a really nice approach for color correction in my opinion. Lift/Gamma/Gain are actually controlling the Shadows/Mid-tones/High-tones of your picture with the ability to offset the colors.
This combine with saturation and exposure could give a powerful tool for color correction. This is the kind of tool you’ll find in plug-in such as Magic Bullet Colorista from Red Giant Software or professional hardware as Black Magic DaVinci

Stu Maschwitz from Prolost did a nice tutorial on how to use his Colorista plug-in

Red Giant TV Episode 22: Creating a Summer Blockbuster Film Look from Stu Maschwitz on Vimeo.

Mirror of http://www.redgiantsoftware.com/videos/redgianttv/item/23/

Lift/Gamma/Gain formula

outputColor = (gainColor*(inputColor+liftColor*(1-inputColor)))^(1/gammaColor)

This has to be done for each channel color for each pixels of your picture.

To make some test of this formula I did use Blender’s compositing and its “Math” node which was pretty useful 🙂 . This operation is useless since it is terribly slow using nodes and it’s already implemented in the Sequencer (properties of the strip), but it’s just for the test !

Here is the blend file and a screenshot :

Lift/Gamma/Gain Formula done in Blender Compositing using "Math" node
Lift/Gamma/Gain Formula done in Blender Compositing using "Math" node