chapter 13 special visual techniques

14
Chapter 13 Special Visual Techniques

Upload: jirair

Post on 22-Feb-2016

45 views

Category:

Documents


0 download

DESCRIPTION

Chapter 13 Special Visual Techniques. Blending. Without blending, a source fragment’s color values are supposed to overwrite those of its destination pixel. With blending, the source fragment does not overwrite its destination pixel . Pay attention to the z-value (depth testing). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 13 Special Visual Techniques

Chapter 13 Special Visual Techniques

Page 2: Chapter 13 Special Visual Techniques

Blending◦Without blending, a source

fragment’s color values are supposed to overwrite those of its destination pixel.

◦With blending, the source fragment does not overwrite its destination pixel.

◦Pay attention to the z-value (depth testing).

◦Blending equation:

Page 3: Chapter 13 Special Visual Techniques

BlendingExample:

◦source (0.6, 0.4, 0.2); dest (0.5, 0.5, 0.5)

◦SourceRb = SourceG

b = SourceBb =0.3

◦destRb = destG

b = destBb =0.7

◦Blending equation gives: (0.3*0.5+0.7*0.6, 0.3*0.5+0.7*0.4,

0.3*0.5 +0.7*0.2) = (0.57, 0.43, 0.29)

Page 4: Chapter 13 Special Visual Techniques

Blending

Page 5: Chapter 13 Special Visual Techniques

FogFog is an atmospheric effect that

OpenGL offers ready to use. glEnable(GL_FOG),

glDisable(GL_FOG)glFogfv(GL_FOG_COLOR, flgColor)glFogi(GL_FOG_MODE, fogMode)

◦GL_LINEAR◦GL_EXP◦GL_EXP2

Page 6: Chapter 13 Special Visual Techniques

FogGL_LINEAR:

GL_EXP:

GL_EXP2:

Page 7: Chapter 13 Special Visual Techniques

Fog

Page 8: Chapter 13 Special Visual Techniques

Antialiasing

Page 9: Chapter 13 Special Visual Techniques

AntialiasingEnable blendingAntialiasing itself is enabled with

a call to ◦glEnable(GL_LINE_SMOOTH)

For the best possible antialiasing with the call◦glHint(GL_LINE_SMOOTH_HINT,

GL_NICEST)

Page 10: Chapter 13 Special Visual Techniques

Environment MappingThe goal of environment

mapping is to simulate an object reflecting its surrounding, e.g., a shiny kettle reflecting the kitchen or a well-polished car reflecting the street.

Sphere MappingCube Mapping

Page 11: Chapter 13 Special Visual Techniques

Stencil Buffer TechniquesA stencil buffer is an extra buffer, in

addition to the color buffer (pixel buffer) and depth buffer (z-buffering) found on modern graphics hardware.

Limit the area of rendering.Make use of the strong connection

between the depth buffer and the stencil buffer in the rendering pipeline.

Can put a heavy load on the graphics hardware.

Page 12: Chapter 13 Special Visual Techniques

Bump MappingTo give the illusion of geometric

detail on a surface, e.g., making it appear ridged or dimpled, by means of perturbing the surface normals, but without actually changing any geometry.

Page 13: Chapter 13 Special Visual Techniques

Raster Algorithms(Reading)Cohen-Sutherland Line ClipperSutherland-Hodgeman Polygon

ClipperBresenham line drawingPolygon rasterizing

Page 14: Chapter 13 Special Visual Techniques

HomeworkExercise 13.3