rendering computer graphics - cnrvcg.isti.cnr.it/~tarini/teaching/cg14/lez02.light_and... ·...
TRANSCRIPT
1
Rendering
• Rendering 3D
Scena 3D rendering image
5M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a
Computer GraphicsImages & Color
Università dell’Insubria
Corso di Laurea in Informatica
Anno Accademico 2014/15
Marco Tarini
Human Visual System Human Visual System: the retina
M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a 8
2
Human Visual System
• Cones
Human Visual System
• Composed of:– Eyes Capture the light and sends signal to Brain– Brain Interprets the signal received from the Eyes
• Visible Light– Wave length between 380 and 780 nm– Infrared, Microwave > 780,– Ultraviolet, X-Ray < 380
• Retina composed of: Rods & Cones• Rods:
– More sensible to small amounts of light – Monochrome– MANY! ~120 Mega
• Cones:– Less sensible– Fewer ~8 Mega. Concentrated in “fovea”.– Three kinds (Long Medium Short): differentiate light wavelenght!
Color Spaces : Primary Colors
Additive Subtractive
Color Spaces
• Difficult to define a representation that is valid for all• All representations use 3 primary colors (as the eye):
colors represented as combinations of them• Two models: Additive Subtractive• Additive: all colors represented as the sum of the
intensity of 3 basic colors, by combining all colors we obtain white. For example: LCD screens, Lights
• Subtractive: each component blocks the opposite color (cyan is the complement of red), by combining all colors we obtain black. For example, Printers, Crayon colors
Interactive Graphics: Color and Images
3
CIE RGB and XYZ
• Very important standard representation • experimentally defined by CIE.• Based on 3 color-matching functions (r, g, b)
CIE XYZ
• Equivalent representation using only positive values
Device–dependent color space
• The Color-space of a device depends on its physical limitations.
• GAMUT is the set of all colors that a device can output
• Examples of GAMUTs forAdditive primaries systems, suchAs NTSC, Adobe RGB, sRGB(used by HP and Microsoft)
HSL and HSV
• HSL: Colors described in terms of– Hue
• Base color– Saturation
• Pureness of the color– Lightness
• Intensity
• HSV: Lightness is substituted by Value
4
Representation change and Illuminant
• Possible to convert between RGB and HSL/HSV representations
• Conversions depend on the Illuminant (spectrum of the light source). CIE XYZ standardized the spectrum defining a number of standard illuminants– Illuminant A corresponds to average incandescent light, B to
direct sunlight• More information at http://brucelindbloom.com/
CIELab and Gamma
• CIELab is a Color space defined by CIE in 1976 using:– L* Lightness– a* and b* Chromaticity
• Euclidean distance between two points correlates very well with human perception of similarity/distance between colors
• In CRT monitors, RGB intensity I is proportional to voltage V as follows I = Vγ
• Gamma correction changes the value of γ
Image Representations
• Images can be represented in several ways, the most common ones are
• Vector images– Image = set of drawing primitives
• Raster images– image = regular 3D gird of small colored tiles
Vector Images: Example
5
Raster Images
• Image defined as a set of pixels (picture elements) aligned in a rectangular shape.
• Size is the number of horizontal and vertical lines (For example, 640*480)
• Pixels defined by a scalar value (grayscale images) or an array of (usually 3) scalar values (color images)– pixel depth = how many bits per pixel
• The length of the vector defines the number of channels. Most raster images use 4 channels, called red, green, blue and alpha, where the fourth channel alpha is used to handle transparency.
Raster Image: gray scale
Raster Images: resolution
38x70 158x30020x3710x19
Raster Images: alpha channel
6
Raster Images: dynamic range
• Ratio between highest and lowest value• HDRI – High Dynamic Range Images
Pros and Cons
• Vector images automatically adapt to the resolution of the device.
• Well suited for computer-generated images such as logos, trademarks, diagrams, stylized drawings and other similar images.
• Raster images well suited for natural images (photos and others).
• Quality of raster images depends on image resolution
Vector Images: common formats
• SVG: – XML-based – developed by W3C – basic shapes, text, colors, patterns …
• PostScript (PS): – printers – high quality printing of images– includes ink control
• Portable Document Format (PDF)– by Adobe– includes subsets of PS
Rarter Images: common formats
• PNG (Portable Network Graphics): – lossless compression– many formats, including: 3 or 4 channels– good for synthetic images
• JPEG (Joint Photographic Experts Group): – (typically) lossy compression (DCT: discrete cosine transform)– 3 channels 8 bits– good for natural images (digital photography)– advancemet: JPEG 2000
• GIF (compuserve)– strange quirk of image format history– used for tiny animations
7
Rarter Images: not so common formats
• TIFF – (typically) lossless, – hi-dynamic range data– hi-quality digital photography
• PNM (portable any map)– not very used– but… trivial to parse (ASCII)
M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a 30
Rarter Images: metadata
• Exif -- Exchangeable image file format– date– camera settings– thumbnail– description– copyright– …– geolocation (GPS coords)
M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a 31