Download - Honours Graphics 2008
![Page 1: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/1.jpg)
Honours Graphics 2008
Session 4
![Page 2: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/2.jpg)
Today’s focus
• Colors
• Vertex coloring
• Gourad and Phong lighting
• Problems with transparency
![Page 3: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/3.jpg)
Colors
• A great variety of color models exist, such as CIE XYZ, HUV, Lab, RGB, etc.
• Stems from work that demonstrated that human eye senses three color spectrums, namely red, green and blue
• Green appears brightest, while human eyes are most sensitive to variation in blue
![Page 4: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/4.jpg)
Colors, cont.
• The premise of color spaces is the realization that a triplet of values is sufficient to uniquely describe a color
• Computers normally make use of RGB color space – as it is simple and thus easily implementable in hardware
![Page 5: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/5.jpg)
RGB
• In RGB each color is defined by three components that represent the red, green and blue weighting of the color
• Typical for modern computers is making use of 8bits per color channel allowing for a 24bit description of color – equivalent to 2^24 = 16 777 216 distinct colors.
![Page 6: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/6.jpg)
RGB, cont.
• In 24bit RGB each color component can vary in value between 0 and 255
• Imaging programs, and modern graphics hardware, typically normalize the colors to a range between 0 and 1
• This allows imaging and color computations independent of the color depth
![Page 7: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/7.jpg)
![Page 8: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/8.jpg)
Vertex coloring
• Both DirectX and OpenGL allow the specification of vertex coloring. The colors specified are then blended across the vertices
![Page 9: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/9.jpg)
Vertex coloring, cont.
• When tris are textured, the result can be modulated with the computed vertex coloring
![Page 10: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/10.jpg)
Vertex coloring, cont.
• Vertex coloring can be used in a variety of useful ways; such as implementing coarse shadows in terrain:
![Page 11: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/11.jpg)
Vertex coloring, cont.
• Another example, particle systems may make use of generic white textures and color the particle using vertex coloring
• Any continuous, area covering shading can be implemented in vertex colors, such as infra-red display
![Page 12: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/12.jpg)
Lighting models
• Displaying an object with some degree of accuracy requires a convincing use of light and shadow
• This in turn requires some underlying lighting model to approximate the behavior of light, such as the Gouraud and Phone lighting models
Image curtesy wikipedia
![Page 13: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/13.jpg)
Gouraud
• Henri Gouraud, published 1971
• Obtain vertex normals by averaging normal of polygons meeting at vertex
• Compute lighting via Phong reflection
• Bi-linear interpolation of color values at vertices
• Essentially “free” in modern graphics hardware due to vertex coloring
![Page 14: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/14.jpg)
Phong
• Bui Toung Phong, published 1973• Distinguish between Phong illumination
and Phong shading• Phong illumination (also reflection or
lighting) describes a model for light reflectivity
• Phong shading (or interpolation) is better approximation to lightning than Gouraud shading
![Page 15: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/15.jpg)
Phong illumination model
• Describes reflections through ambient, diffuse and specular components
Image curtesy wikipaedia
![Page 16: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/16.jpg)
Phong shading
• Improves on Gouraud shading, instead of interpolating colors it interpolates normals which are then used with the Phong illumination model
![Page 17: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/17.jpg)
Transparency problem
• Partial transparency is a useful tool for a wide variety of graphics effects (particle systems, windows, etc.)
• A problem exists with transparency order though: if multiple transparent areas overlap, then the order in which they are rendered changes the result
![Page 18: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/18.jpg)
Transparency problem, cont.
• The solution is to ensure they’re rendered from back to front
• Hardware may eventually automate this
![Page 19: Honours Graphics 2008](https://reader036.vdocuments.us/reader036/viewer/2022081821/56812fc3550346895d9544c8/html5/thumbnails/19.jpg)
Homework
• Implement the ROAM terrain algori--- nah, I’m kidding, no homework today