« Bar Code Art by Scott Blake | Main | Nikon D200 Zone System Dynamic Range »

February 25, 2006

Color Transparency in Computer Graphics

colorTransDemo.jpg

A colored, transparent object derives its color from the degree to which it filters (multiplies) the background that color.

If you put most of the color of an object into its diffuse component, and make it "transparent" by dropping its alpha channel, or putting gray into the transparency channel, you'll get muddy-looking CG.

Here's a comparison of two approaches to colored transparency using Maya.

stackedPSlayers.jpg

This is what many people do. This resembles a bunch of "normal" layers in Photoshop with the "opacity" set to a midrange percentage. People may call this transparency, but that's a lazy use of the word.

The main thing you get by doing this is a muddy color that doesn't match your swatch - even over a white background - and nothing more interesting than a progressive drop in luminosity of the same hue with each passing layer.

stackedCellophane.jpg

Here's an alternative approach. Notice how the color in the top layer matches the color swatch in the shader, and how successive "multiplies" of the pale, desaturated color cause it to darken and saturate, just like multiple layers of colored cellophane do.

This techique works best over bright, less saturated backgrounds. It's hard to see colored cellophane, digital or real, over a black background. A little bit of color in the diffuse channel will help visibility, and is often warranted. Too much color in the diffuse channel coupled with a lot of color in the transparency channel will produce an odd "negative" effect. If you are going for realism, you probably shouldn't have pure (0 0 0) black in your image anyway.

Here's a somewhat related entry on

Transparency Mapping and Matte Lines

UPDATE 4/16/2006

Thanks to all the interest in this entry generated by mentions on web sites such as Death Fall, I am expanding this entry to include an example of colored rgb transparency in a more typical setting.

sphereTransShader.jpg

Let's look again at a simple blinn shader with color set to a low value and transparency set to a color.

singleSphere.jpg

Here's a single-sided sphere under a white point light. Notice that the sphere (as seen against the bright checkerboard) appears to be the same orangey-red as the transparency swatch. Notice also that the specular highlight is white.

singleOppSphere.jpg

Here's the same sphere and the same shader, only this time the normals are reversed so as to make the sphere a hollow bowl facing the camera.

doubleSphere.jpg

Finally, here is the shader on a double-sided sphere. Notice what happens:

1) We are seeing through two layers of red filtration, so the red is richer. How much richer? It has the same color filtration value as you'd get by multiplying the color transparency swatch by itself.

2) We are seeing the inner specular highlight trough one layer of red filtration, so it has become an obvious red color.

To see this phenomenon in real life, take a look at these amazing new colored bubbles!

Posted by digital artform at February 25, 2006 10:47 AM

Comments

what an interesting observation!! I had always wonder what good is a 3 channel transparency, until I saw this.

Posted by: david ying at March 2, 2006 09:08 PM

Yes Lots of people don't know that but Maya is ever learning tool. Every now and then I learn something that might been there from v. 1.0. but I dint know about it. One thing that kind of bugs me is how the hell is that Photoshop HDR merge alignment works?
How does it Auto align? Some sort of pixel difference method? Don't know but I would like to find out.

Your expeditions are always a pleasure to read : )

Kristijan

Posted by: Kristijan at March 13, 2006 05:16 AM

Thank you both

Posted by: Joseph Francis at March 18, 2006 01:41 PM

I tried your interesting theory in Maya straight away, but the result I am getting is totally different.

Are you sure with this? What Maya version are you using? I use Maya 7. I tried this on Maya 6 as well, but I still get much 'nicer' result with the normal way of applying transparency (Color = colour value; Transparency = greyscale value of transparency). The difference seems to be more visible with Shader with specularity.

Although I do have similar question of what is the use of RGB in Transparency. Have you tried using the same colour hue for Color and Transparency? It is even stranger.

I would say they give different effects that can be used depending on the need.

Posted by: Jimmy Gunawan at April 15, 2006 12:58 AM

I have another try, but this time with Diffuse channel comes into play as well, while keeping Color and Transparency with coloured value. When the Diffuse is zero value (black), I got the same result. If the Diffuse value is lowered, you will get strange effect.

By the way, you got the Yuck result with above because the Diffuse value on that shader was set with value lower than 1. Try also setting the value to 1 or higher, you will get result that's also interesting.

Posted by: Jimmy Gunawan at April 15, 2006 01:11 PM

Jimmy, I'm curious to see your results. Are you rendering on a bright background? What I wrote assumes such.

Do you have a scene file? I'm also running Maya 7.

Posted by: Joseph Francis at April 15, 2006 03:09 PM

Great observation! i have never seen a technique such as this. U are the best!

Posted by: CerebroDigital at April 16, 2006 08:05 AM

Thank you!

Posted by: Joseph Francis at April 16, 2006 04:18 PM

Post a comment




Remember Me?

(you may use HTML tags for style)