<<

Rendering • Rendering 3D Images & Color

Università dell’Insubria Corso di Laurea in Informatica Scena 3D rendering image Anno Accademico 2014/15 Marco Tarini

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 5

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

1 Human Visual System Human Visual System

• Composed of: – Eyes Capture the light and sends signal to Brain • Cones – 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 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 . For example: LCD screens, Lights • Subtractive: each component blocks the opposite color ( is the complement of ), by combining all Additive Subtractive colors we obtain . For example, Printers, Crayon colors

Interactive Graphics: Color and Images

2 CIE RGB and XYZ CIE XYZ

• Very important standard representation • Equivalent representation using only • experimentally defined by CIE. • Based on 3 color-matching functions (r, g, b) positive values

Device–dependent HSL and HSV

• The Color-space of a device depends on its physical limitations. • is the set of all colors that • HSL: Colors described in a device can output terms of • Examples of for – Additive primaries systems, such As NTSC, Adobe RGB, sRGB • Base color (used by HP and Microsoft) – Saturation • Pureness of the color – • Intensity • HSV: Lightness is substituted by Value

3 Representation change and Illuminant CIELab and Gamma

• CIELab is a Color space defined by CIE in 1976 • Possible to convert between RGB and HSL/HSV using: representations – L* Lightness • Conversions depend on the Illuminant (spectrum of the – a* and b* light source). CIE XYZ standardized the spectrum • Euclidean distance between two points correlates very well with defining a number of standard illuminants human perception of similarity/distance between colors – Illuminant A corresponds to average incandescent light, B to • In CRT monitors, RGB intensity I is proportional to voltage V as direct sunlight follows I = V γ • More information at http://brucelindbloom.com/ • changes the value of γ

Image Representations Vector Images: Example

• 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

4 Raster Images Raster Image: gray scale

• 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 ( 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, , and alpha, where the fourth alpha is used to handle transparency.

Raster Images: resolution Raster Images: alpha channel

10x19 20x37 38x70 158x300

5 Raster Images: dynamic range Pros and Cons

• Ratio between highest and lowest value • Vector images automatically adapt to the • HDRI – High Dynamic Range Images 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 Rarter Images: common formats

• SVG: • PNG (Portable Network Graphics): – XML-based – lossless compression – developed by W3C – many formats, including: 3 or 4 channels – basic shapes, text, colors, patterns … – good for synthetic images • PostScript (PS): • JPEG (Joint Photographic Experts Group): – printers – (typically) lossy compression (DCT: discrete cosine transform) – high quality printing of images – 3 channels 8 bits – includes ink control – good for natural images (digital photography) • Portable Document Format (PDF) – advancemet: JPEG 2000 – by Adobe • GIF (compuserve) – includes subsets of PS – strange quirkof image format history – used for tiny animations

6 Rarter Images: not so common formats Rarter Images: metadata

• TIFF • Exif -- Exchangeable image file format – (typically) lossless, – date – hi-dynamic range data – camera settings – hi-quality digital photography – thumbnail – description • PNM (portable any map) – copyright – not very used –… – but… trivial to parse (ASCII) – 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 30 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

7