PhotoRealistic RenderMan
Application Note #29
Beginning with the 3.9 Release, PhotoRealistic RenderMan support the concept of fractional mattes. Matte objects no longer necessarilly cull all of the objects which appear behind them. The opacity of the matte object is allowed to decide how much of the objects behind are visible. This allows mattes to be created of scenes with semi transparent objects in a way which is a consistent generalization of the old behavior. This note helps describe this new semantics in detail, and illustrates how it might be useful.
We can generate two more images, one of the red object with the green matted out, and the other of the green image with the red object matted out.
We can regenerate the original image from the two sub images by simply adding the colors at every pixel. This is very similar to what actually happens with compositing which is done with conventional film processes.
We begin by thinking of precisely what we wish to have happen. We have several constraints in mind:
Opaque matte objects should behave as previously defined, namely by hiding all objects which occur behind them.Normally at each pixel we resolve the visibility of transparent objects by using the over compositing rule. The rule says that to compute the color of A over B, we apply the following rules:
Completely transparent matte objects should behave as if they weren't there at all, causing no modification to any pixel values.
In any case where we have two objects A and B, the sum of (A matte B) and (B matte A) should equal the image with A and B.
Color(A) over Color(B) = Color (A) + (1 - Alpha(A)) * Color(B)If A was a matte object previously though, we had a different rule. The color of a matte object was always defined as transparent black, no matter what it's actual color or alpha values were, or whatever objects you had behind it. If A was a matte object, you might have written this rule as
Alpha(A) over Alpha(B) = Alpha(A) + (1 - Alpha(A)) * Alpha(B)
Color(Amatte) over Color(B) = blackWhat we really desire is to allow some of the background object to show through when A is a transparent matte object. In fact, when A is perfectly transparent, it should act as if A was not there at all. Some head scratching will eventually lead you to the following formulas:
Alpha(Amatte) over Alpha(B) = 0
Color(Amatte) over Color(B) = LERP(Color(B), Black, Alpha(Amatte))where LERP(a, b, t) = (1 - t) * a + t * b, the conventional linear interpolation function.
Alpha(Amatte) over Alpha(B) = LERP(Alpha(B), 0, Alpha(Amatte))
Pixar
Animation Studios
|
Pixar Animation Studios
|