ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Blog: Primary Color Mixing in After Effects

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sterling Glass
Blog: Primary Color Mixing in After Effects
on Jan 9, 2012 at 2:35:55 am

Aharon Rabinowitz posted an interesting request earlier today on Twitter: "If anyone can demonstrate Red/yellow/blue (primary) color interaction in AE, I would love to see a comp. can't get it to work."

Here is the thought process I used to get the results. The solution is at the end.

RGB vs. CMY vs. RYB according to Sterling

As most After Effects users know, RGB is the standard color space within the software, but there is more than one method to manipulate the colors. I will be keeping this simple for the math involved. Using 8-bit color, the values range from 0 to 255. 0 is no color; 255 is maximum color. The color maps for RGB are three values, typically separated by a comma, which range from 0 to 255. Full RED is 255, 0, 0. Full GREEN is 0, 255, 0. Full BLUE is 0, 0, 255.

RGB is also an additive color space. 0, 0, 0 is black; 255, 255, 255 is white. If you were to add the full values of RED, GREEN, and BLUE together, you would get white.

255, 000, 000
000, 255, 000
+ 000, 000, 255
= 255, 255, 255

Print uses the CMYK color space (cyan, magenta, yellow, and black) where a color is define by the amount of pigment is used. Simplified, as you add more colors together, you get closer to black. Typically in printing, 100% of CMY is a muddy gray color, which necessitates the need for black. Also, 100% black ink is cheaper to use than 100% each of the CMY inks.

CMYK is often referred to as a subtractive color space. 0% of each color will show nothing, such as a blank piece of paper. 100% of each color will show the maximum saturation of that color on that media. The more color you add, the darker final result will become. Dark + Dark + Dark = Really Dark.

Fact: cyan, magenta, and yellow are secondary colors to red, blue, and green. Being familiar with CMY and RGB colors is very helpful when trying to figure out why the actress's face looks blue.

The “primary” colors we were taught in school growing up are red, yellow and blue. When we add these colors together (50% of each one), we get new colors: red + yellow = orange, yellow + blue = green, and blue + red = purple (violet). These new colors are often referred to as secondary.

These primary colors are still used in painting and drawing. They are also considered subtractive. In practice, the combined color is usually a grayish-brown. has a couple great color charts: one for RGB/CMY colors and the other for RYB colors.

Primary and Secondary Colors in AE

This portion was easy after playing with the color picker in AE:
Red = (255, 0, 0)
Yellow = (255, 255, 0)
Blue = (0, 0, 255)

I played around a bit longer in the AE color picker to choose the following values the secondary colors (my goal was to keep the math simple so 255 = 100% and 128 = 50%):
Orange = (255, 128, 0)
Green = (0, 255, 0)
Purple = (128, 0, 255)

Primary Color Mixing

My first few attempts at mixing primary colors were not good. I went through just about every single combination of layer modes with all the RYB colors and transparency values in 5% increments from 0% to 100%. In short, not efficient.

Red + Yellow = Orange
Looking at the math, Red + Yellow does not equal Orange. Immediate flag is that the value for a color cannot exceed 255 in 8-bit color.

255, 000, 000 Red
+ 255, 255, 000 Yellow
= 255, 255, 000 Green?

First AHA! moment: I only need 50% of the yellow showing to get orange.

I created a quick comp with a few solid layers. I included a white layer at the background in case I had plans for crazy blending modes. The colored layers were offset to see the two primary colors and the blended/mixed secondary color. Layer order was: Red at 50% opacity, Normal blend; Yellow at 100% opacity, Normal blend; White at 100% opacity, Normal blend. The red looked pink at 50% opacity, so I duplicated the layer and placed it under the Yellow layer at 100% opacity.

Yellow + Blue = Green Part 1

I looked at values for Yellow (255, 255, 0) and Blue (0, 0, 255). Then, I looked at the value for Green (0, 255, 0). Using AE to add the values would give me white (255, 255, 255). Subtracting the values would give me black (0, 0, 0). I'll come back.

Blue + Red = Purple

I jumped the gun and saw that purple was similar in design to yellow with a half value for one of the RGB colors: (128, 0, 255). Using the same layer order as the orange comp, I substituted Blue for Yellow and got Purple.

Yellow + Blue = Green Part 2

So, Yellow + Blue = White when using AE to add the colors. Green = (0, 255, 0). What I needed was a way to remove the 255 from Red and 255 from Blue in the final comp. I quickly created a new solid with a color of (255, 0, 255) and noticed it was magenta. I placed it over the staggered Yellow and Blue solids and set the blending mode to subtraction.

TADA! Green. It's cheating, but it's still green.

The Big Finale

Per Aharon's Twitter request, he would like to see an AE comp with RYB blending. Without any nesting, I copied over my sample comps to create a single composition showing "RYB blending" with a dash of magenta subtraction to help After Effects along with the complex math.

Here's a close-up of the layers and blending modes. I created a mask for the Magenta layer, and it is at 100% opacity.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved