Thursday, May 6, 2010

Color Bleeding

Color bleeding is a term used in the computer graphics industry to describe the way the color of an illuminated surface influences the surfaces around it.

Traditional painters usually refer to the effect as “reflected light,” and you can see it in this photo of an Abe Lincoln bust with a colored card in direct sunlight.

Here is an example of a digital scene with simple direct illumination (left), and then again with color bleeding (right).

Note how the white ball in the right image is tinged with blue on one side and red on the other. The same colored spillover appears on the ceiling and the back wall.

The phenomenon is a hot subject in CG rendering right now because new techniques are emerging to accomplish it. The technique called ray-tracing conveys the effect very convincingly, but it takes a lot of computer rendering time.

A new technique, using a “point cloud,” to generate the effect, can be accomplished with a fraction of the rendering time.

The recent Pixar movie “Up” used this technique to great effect in the sequence where the house is floating through the upper atmosphere.

Here’s a good overview by a lighting expert from "Up" on CG Society (Part 1 and Part 2), explaining its use in “Up”

I’m indebted to Jason Hill of Blizzard for sharing his knowledge with me.


armandcabrera said...

It is interesting how much digital falls short of the truth. In the real thing the light is much more complex; the digital pieces need a person to set each attribute which always leaves soemthing missing, either a shadows edge quality or the way the colors don't mix properly. It definitely creates its own aesthetic.

Don Cox said...

Traditional ray tracing is fairly fast, but does not render this kind of reflected light. The rendering technique that does allow for light reflected by nearby colored surfaces is called "radiosity". Programs such as Lightwave or 3D Studio Max offer it as an option when rendering. It greatly increases the rendering time.

Sam Nielson said...

Fascinating article, thanks for sharing it.

James Gurney said...

Don, thanks for explaining that. Obviously my knowledge of the digital tools is very limited, and I appreciate you sharing hands-on insights.

Dave said...

This is very interesting. Julianne and I are sitting here reading this.The ideas behind computer generated colors are moving so fast! What would I do without your blog? Indeed, what would all of us do without your blog?!

Sunlight is the best light in which to work. Julianne and I are both impressed with how well pixar recreates it.

Dave and Julianne

Cuprohastes said...

There's many ways to carry out radiosity, and one of the more popular (But older) ones is to use particle effects.
If you imagine the light as a source of photons and that for our purpose photons act like BB gun pellets, and then cap the number of photons to 100, you can have the light fire out 100 photons and simulate where they bounce to quite easily.
For our purposes, let's say we only measure them for the first two bounces or until they're out of shot - whichever comes first.
Then we can measure the distance travelled and apply a simple formula for loss of lighting power over that distance, and also say "Every time a photon bounces off an object it loses energy".
A white photon hitting a red ball will lose a certain amount of lighting energy and when it hits the red surface it will lose most of its blue/green energy then the next time it hits, it'll only have red energy.
Then you take all those hit points and you average them to get an illumination map.
Naturally it'll be very poor because you only used 100 points for the entire scene, but it gives you an idea of how things are working out so you can then increase the count up to a million or two....
And 4 hours later your scene will be rendered.
Then again, assuming you need to render several tens of thousands of frames, you will be really interested in any way of speeding this up...

laurghita said...

Yes, radiosity is the term used for that effect in 3D application, bleeding sound more like an artist term, like a 2D word.

Pseudonym said...

Don Cox, very few modern renderers use radiosity, because it generally can't handle the complex geometry that you see in modern scenes, and it's difficult to handle surfaces which aren't Lambertian (i.e. matte). Modern renderers really do use ray tracing.

Generally speaking, a modern renderer will use ray tracing to shoot photons from light sources and store them in a data structure called a "photon map". This is sometimes done on simplified geometry for speed. Then, in a subsequent pass, the scene is rendered from the camera position, shooting rays from each point (though this information is cached, so it's not every point), to compute indirect lighting.

For this final pass, renderers go to some trouble to save most of the work for the final "bounce" of indirect lighting, since this contributes most to the scene. This is often referred to as "final gathering".

But it's also common for ray tracers to estimate the indirect illumination directly via ray tracing, using the information in the photon map to make intelligent decisions about where the indirect light is probably coming from.

Pseudonym said...

OK, just to be clear: The computer graphics term for this effect is "colour bleeding", "indirect lighting" or "global illumination".

"Radiosity" is a specific method of achieving this effect, which was one of the first methods which was practical. As the geometry in scenes got more complex and models for the way light reflects on surfaces got more sophisticated, the radiosity method fell out of favour because it simply didn't scale up.

One major benefit of the photon mapping is that photon maps are completely decoupled from the scene geometry, so it doesn't matter how complex the scene is.

Mark Heng said...

Hi, I was just struck by the image of Lincoln and how saturated the color of the reflected light looked, especially compared to the direct light on the red card.

James, any thoughts? Is this something you'll be covering in your book?

Purple Artist said...

I always have the urge to pick up my paintbrush when I see color reflected in lights and shadows. Delicious. Part of me wishes the digital world would stay away from this concept. They will no doubt surpass what traditional art can capture. I am not (completely) paranoid, but I am concerned that technology could almost render artists obsolete.

James Gurney said...

Thanks, everybody, for adding your insights here. Mark, that's very perceptive of you, and I think what we're seeing is a photographic effect of bleaching because the illuminated surface of the red card is more highly exposed than the reflected red light. The reflected light, being a more midrange exposure, is more saturated. Usually, the eye would see the illuminated surface as a more intense red.

Don Cox said...

"The computer graphics term for this effect is "colour bleeding", "indirect lighting" or "global illumination"."

I think you will find that different programs use different terms for the same thing, or the same term for different things.

I used ray-tracing renderers for years which had global illumination, long before any attempt was made to render the radiosity effects that James shows in his pictures. The global illumination was simply an overall, non-directional background light, to stop the shadows being pitch black.

The first examples of true radiosity that I saw were rendered with the program "Lightscape", which is now a part of Max. IIRC this was about 8 years ago. Example images are here.

The Wikipedia article on Radiosity (3D computer graphics) is useful.

Katherine Kean said...

This is the kind of detail that makes all the difference. I remember when we did this - by hand - for motion picture visual effects, to accompany a light effect, such as an explosion, and added what we called "interactive light" to nearby objects in order to blend the animated effect into the live action.

We had time to do this back then because we didn't have personal computers, cell phones, or blogs.

Kevin said...

I think the term color bleeding comes from the photography world.

It's worth mentioning that Pixar doesn't use radiosity, including point cloud lighting, in the vast majority of their shots. Most of the time, they simulate the effect by adding low-intensity, diffuse spot lights of the appropriate color. This gives a lot more room for artistic freedom, letting lighting artists work in a manner as much like painting as photography.

Arashi Kensho.Corp said...

Arashi Kensho
Wow.. Very good contenT...!! thank you!!