24
Real-Time rendering Real-Time rendering Chapter 4.Visual Appearance 4.4. Aliasing and antialiasing 4.5. Transparency,alpha,and compositing 4.6. Fog 4.7. Gamma correction 2002.04.10 李李李

Real-Time rendering Chapter 4.Visual Appearance 4.4. Aliasing and antialiasing 4.5. Transparency,alpha,and compositing 4.6. Fog 4.7. Gamma correction 2002.04.10

Embed Size (px)

Citation preview

  • Real-Time renderingChapter 4.Visual Appearance

    4.4. Aliasing and antialiasing4.5. Transparency,alpha,and compositing4.6. Fog4.7. Gamma correction

    2002.04.10

  • 4.4 Aliasing & Antialiasing (1/6)AliasingVisual artifact is called the jaggiesAntialiasing efforts to avoid itTwo other common problem areasTexture aliasing : section 5.2.2Line aliasing

  • 4.4 Aliasing & Antialiasing (2/6)Line Anti-aliasingMethod To treat the line as a quadrilateral one pixel wide To consider it an infinitely thin, transparent, glowing objectTo render the line as an antialiased texture

    Supersampling TechniquesBy using more samples per screen grid cell and blending these in some fashion, an average pixel color can be computed

  • 4.4 Aliasing & Antialiasing (3/6)To implement Higher sampling rates (1/2)Combine the neighboring samples to create an imageTo render the scene at a higher resolutionex) Image of 500*400 To render an image of 1000*800 generated with 4 samples per pixel (:hardware accelerator)

    Accumulation bufferView moved half a pixel in the screen x- or y- direction as neededSuch effects as motion blur and depth of fieldreal-time rendering expensive

  • 4.4 Aliasing & Antialiasing (4/6)To implement Higher sampling rates (2/2)MultisamplingTo increase the sampling rate per pixelFor generating high-quality renderingBut at non-interactive speedsUsed the coverage mask & z-depth

    ..4*4 sub grid16bit mask for this cell(0000 0111 1111 0111)

  • 4.4 Aliasing & Antialiasing (5/6)How each polygon covers a grid cell? have some limitationsSize of the Coverage mask9 level (common)65 level (arbitrary)Box filtersimplicityLack of gamma correctionDiscussed in Section 4.7.

  • 4.4 Aliasing & Antialiasing (6/6)Supersampling schemes expensive to support in hard ware application

    ex) Direct3D Edge antialiasingProblem: all edges are redrawn, application must identify likely edges to redrawFull-scene antialiasingRequires the polygons be sorted from back to frontRendering with only one pass through the dataProblem: Expensive

  • 4.5 Transparency,Alpha & Compositing (1/7)Transparency effect in real-time rendering systemsSimplistic Limited

    Effects normally unavailable includesemi-transparentThe blending of light (refraction)ReflectivityTransmission changes due to the viewing angleBut, powerful tool for a variety of techniques(see Chapter 6. Special effect)

  • 4.5 Transparency,Alpha&Compositing (2/7)Method1: Screen-door transparencySimple method for giving the illusion Checkerboard fill patternleaving the object behind it partially visibleProblems with this technique include:Only 50% transparentOnly one transparent object can be convincingly rendered on one area of the screen

  • 4.5 Transparency,Alpha&Compositing (3/7)

    Method 2: alpha blending (1/3)For more general and flexible transparency effectsRGB color & Z-buffer depth are associated with each pixel

    alpha(a)Another componentValue describing the degree of opacity of an object for a given pixel1.0 means : opaque 0.0 means : not obscuredEach pixel covered : RGBa (=RGBA)

  • 4.5 Transparency,Alpha&Compositing (4/7)

    Method 2: alpha blending (2/3)

    Example : Blendinga=0.6/surface(0.8,0.7,0.1)/Light blue(0.7,0.7,0.9) (0.76,0.7,0.42) C0 = aCs + (1- a)CdC0 :resulting color,Cs :source, Cd :destination

  • 4.5 Transparency,Alpha&Compositing (5/7)

    Method 2: alpha blending (3/3)

    To render transparent objects properly into a scene usually requires sortingBack-to-front orderBlending equation is order-dependentOver operatorsNot commonly used in real-time applicationCan be used for antialiasing edgesTransparency or antialiased edges

    C0 = aCs + (1- a)CdC0 :resulting color,Cs :source, Cd :destination

  • 4.5 Transparency,Alpha&Compositing (6/7)

    Method 3: compositing (1/2)For blending together photographs or renderings of various objects

    Two ways to store the RGBa values generated [ex) surface(0.8,0.7,0.1)/ a = 0.6]Premultiplied alphas: RGBa is (0.8, 0.7, 0.1, 0.4)Unmultiplied alphas: RGBa is (0.48, 0.42, 0.06, 0.4)

    Advantage of Premultiplied alphas :C0 = Cs + (1- a)Cd

  • 4.5 Transparency,Alpha&Compositing (7/7)

    Method 3: compositing (2/2)A concept related to the alpha channel is chroma-keyingIn the film industry this process is called blue-screen matting

  • 4.6. Fog (1/5)Simple atmospheric effectCan be added to the final imageSeveral purposesIncreases the level of realism for outdoor scenesIncreases with the distance from the viewerTo provide smoother culling of objects by the far planewithout fog, a popping effect is experiencedOften implemented in hardwareLittle or no additional cost

  • 4.6. Fog (2/5)color of the fog(cp )

    As f decreases, the effect of the fog

    increasesLinear fogExponential fogSquared exponential fogcp = f cs+(1- f ) cf cs :color of a shaded surface/cf :color of fog/ Fog factor f [0,1]

  • 4.6. Fog (3/5)increases Linear fog :

    exponential fog :squared exponential fog :Zp :depth from the viewer/Scalar df : to control the density

  • 4.6. Fog (4/5)exp2 0.33 exp2 0.66Originalfog color=pinklinear fogexp 0.33exp 0.66

  • 4.6. Fog (5/5)Compute fogZ-depth vs. Radial fog

  • 4.7. Gamma Correction (1/5)To display them on a monitorpixel values computedphysical relationship voltage input to an electron gun in a CRT(cathod-ray tube)monitorthe light output by the screen

    Gamma value :2.3~2.6NTSC,the color TV encoding scheme:2.2HDTV :2.222

  • 4.7. Gamma Correction (2/5)4.17

    At its simplest, assuming black level is zero:

    Ex) gamma of 2.2/ci=0.5gamma-corrected c is 0.73

  • 4.7. Gamma Correction (3/5)Gamma correction is important to real-time graphics in a few areas:Cross-platform compatibility :SGI,Apple Mac.Color fidelity, consistency, and interpolationDitheringLine and edge antialiasing qualityAlpha blending and compositingTexturing

  • 4.7. Gamma Correction (4/5)gamma -corrected =1.0gamma-corrected=0.2gamma -corrected =5.0

  • 4.7. Gamma Correction (5/5)Problem 1:banding(=contouring) artifactsImplemented in some hardwareMany applications is to ignore

    Problem 2:some software(e.g.,games) include a controlnot a user preference