# Digital Image Compositing What is compositing anyway Why

Document Sample

```					           Digital Image Compositing                                     Compositing for volume rendering
The initial pixel color = Black opaque
c1
Back -to-Front compositing :
use ‘under’ operator
c2

C = backgrond ‘under’ C3
c3
C = C          ‘under’ C2
C = C          ‘under’ C1
A          B
Co = cA (1-   αB) + cB
Cout = Cin * (1-α(x)) + C(x)* α(x)

Compositing for volume rendering                               What is compositing anyway?
Or you can use ‘Front-to-Back’                                           n    A method for combining two or more
Compositing formula                                 c1                       images in a way that approximates the
Front-to-Back compositing :                                                  intervisibility of the scenes
c2
use ‘over’ operator

c3
C = backgrond ‘over’ C1
C = C ‘over’ C2
=                   “over”
C = C ‘over’ C3
…
Cout = Cin + C(x)* α(x)*(1 -   αin); αout = αin + α(x) *(1-αin )         2 ½ D rendering       : scenes have to be disjoint in depth

Why compositing?                                               How to composite?
n Special effects (shake hands with
n   A separate component other than RGB
important people…)
is needed to represent the coverage of en
n Share the load of rendering
element at a pixel
n Render translucent objects (translucent

polygons, volume rendering, etc)                             n   This component is called alpha channel
n   alpha = 0 -> zero coverage
n   alpha = 1 -> full coverage

1
How to composite? (2)                                          Alpha Channel
n    1 bit matte                                          n   The value of alpha can be in [0,1] to indicate
the extent of the coverage
Foreground                                                            (or how opaque the object is)
Cf
n   A pixel’s ‘color’ is represented by a
(0,0,0,1) = opaque black
Background                                      Cf if   αf = 1
Cb                                                                         (0,0,0,0) = transparent
C =
R           G     B              Cb if   αf = 0

Alpha Channel (2)                                              Pre-multiplied alpha
n     How to represent a pixel that is half covered                  Given C = C f * α + (1−α) * C b
by a full red object?                                          Every time we want to perform composite, we
-> (1,0,0,0.5) ?                                                need to multiply the color by its alpha

the red contribution is - 1* 0.5                                -> why not just pre -multiplied the color
components by alpha and stored that way?
n     If we want to composite a foregrond
(R,G,B,α) −> (Rα, G α, Bα, α)
color C f (1,0,0) over a background color C b
then we do C = (1,0,0) * 0.5 + (1-0.5)*C b                      This way, we have C = C f + (1-α) C b
(r,g,b,α) premultiplied quadruple -> (r/α, g/α, b/α, α)
i.e. C = C f * α + (1−α) * C b                                                                         real color

Compositing Algebra                                            Compositing Algebra (2)
n    Foreground over background is only one of                 What is alpha any way?
the compositing (the simplest) methods.
1. Represents the opaqueness of semitransparent
n    What are the formula for all possible kind of              objects. With alpha = α, the object will let (1-α)
compositing (A over B, A under B, A in B…)?                of backgound color go through

n    The issues is to understand and formulate the
Screen door
interplay between the alpha values of two
input picture
Smaller alpha        Larger alpha
(more transparent)   (more opaque)

2
Compositing Algebra (3)                                                        Compositing Algrbra (4)
2. Represents the amount of pixel area covered                                                          A and B

by the object. (1-a) of the pixel is not
Assumption: If B has alpha
covered, and a of the pixel is covered.
(this method is better for understanding this paper)
value αB, then the area A is
Also divided as α B and 1 – α B
A                                        B                                                           And vice versa

αA                                                                αB
A and B        B and A

1− α Α
1−α B                              A and B

Possible Compositing of A,B                                                    Compositing Arithmetic
A and B (AB)
All the possible compositing of               Basic Idea:
A and B can be enumerated based               To composite A an B: Each input picture source (A or B)
on the value in the four regions                                              will survive in its own matte (α), and
( 0, A, B, AB)                                                                the fraction (F A) of its own matte not
αA                        covered in the output picture

α A, and (1- α B)
A over B:
Example: A survives in
(0, A,B,A)                                                So     final color co = contrib. A + contrib. B
A and B (A)        B and A (B)

αo α A F A C A + α B F B C B
B over A:                                                 co      =

A and B (0)                     (0, A,B,B)                                1−α A                                  α AF A + α BF B

Compositing Arithmetic (2)                                                     Compositing Arithmetic (3)
co       =
αo     α A F A CA + α B F B C B                             Co = cA FA + cB FB (note that Co is also alpha premultiplied color)

α AF A + α BF B                                  Example 1: Now let’s look at ‘Over’

We know FA = 1, FB = 1-        αA
since     α o = α AF A +α BF B                                                 So we have Co = cA + cB (1- A)        α
cA = CA       αA    and cB = CB   α A (cA, cB are alpha premultiplied color)   Example 2: ‘Under’

Co = cA FA + cB FB (note that Co is also alpha premultiplied color)
FA = 1-   αB   FB = 1

So Co = cA (1-   αB) + cB

3
Compositing for volume rendering                                  Compositing for volume rendering
Or you can use ‘Front-to-Back’                                       The initial pixel color = Black opaque
Compositing formula                                 c1                                                                  c1
Back -to-Front compositing :
Front-to-Back compositing :                                          use ‘under’ operator
c2                                                                  c2
use ‘over’ operator
C = backgrond ‘under’ C3
c3                                                                  c3
C = clear ‘over’ C1                                                  C = C          ‘under’ C2
C = C ‘over’ C2                                                      C = C          ‘under’ C1
C = C ‘over’ C3                             Co = cA + cB (1-   αA)              A         B
Co = cA (1-   αB) + cB
…
Cout = Cin + C(x)* α(x)*(1 -   αin); αout = αin + α(x) *(1-αin )     Cout = Cin * (1-α(x)) + C(x)* α(x)

4

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 5 posted: 11/9/2009 language: English pages: 4
How are you planning on using Docstoc?