Tinted transparency

Let’s start with something simple first. Our colors have so far contained three numbers: one for red, one for green, and one for blue. There is a fourth number in colors as well. It stands for filter and is assumed to be zero if it isn’t specified. Change your “color green” to:

color Green filter .5

image 21When you add a “filter” to a color, the color will let some light through. In this case, the color is green and the filter is .5, so any green light is let through at 50% of its normal strength. Take a look at the shadow that the ring is casting on the sphere. Where it was black, it now has a greenish tint to it.

Our light source is fully white, and white contains 100% red, green, and blue. When the filter on the ring was zero, the ring didn’t let any light through, thus casting a dark shadow onto the sphere. By specifying a filter of 50% for our green, we’re still not letting any red or blue light through, but any green gets dropped to half strength and continues on.

If you are specifying “rgb” values as we did before using the colors.inc include file, you can specify rgbf to add a fourth value for filter.