View volume The fast forward version The Display pipeline Computer Graphics 1, Fall 2004 Lecture 3 Chapter 1.4, 1.8, 2.5, 8.2, 8.13 Lightsource Hidden surface 3D Projection View plane 2D Rasterization Camera or observer Transformation Shadow Clipping The Graphics Pipeline Polygon in The Display Pipeline The order may vary somewhat... Transform Clipping HSR Light calculations... Modelling, create objects (this is not really a part of the pipeline) Transformations, move, scale, rotate View transformation, put yourself in the origin of the world Clipping, cut away things outside the view volume Hidden surface removal - We do not see through things Light and illumination, shadows perhaps Projection 3D to 2D Rasterization, put things onto our digital screen Texture, shading, image based HSR... To draw images To write the right numbers at the right places in this large array (the screen buffer) This is often done by a function called write_pixel(x,y,color) or (if possible) by directly writing in the array buffer[y][x]=color; Triangles Using write_pixel, we can draw lines and we can draw polygons Tessellation: cutting polygons into smaller polygons In fact, we need solely triangles Triangularisation: cutting polygons into triangles Triangles are always flat, which is a nice property Patrick Karlsson 1
Object in World We put our triangles together to form objects We put the objects in a 3D world We use a camera model to view the world Transformations, etc. We use transformations to move around in the world, as well as to move objects around in the world We add light to get a nice 3D effect We remove things we cannot see Fixing some more Visualization We may speedup things using maps of different types, e.g. textures Starting from polygons, it is tedious to build a world. We need modelling tools. Splines and fractals are two such tools COLOR Elements of color Patrick Karlsson 2
Color = The eye s and the brain s impression of electromagnetic radiation in the visual spectra. How is color perceived? Visible spectrum light source s( ) reflecting object r( ) detector rods & cones red-sensitive r() green-sensitive g() blue-sensitive b() The Fovea There are three types of cones, S, M and L Rods Sense luminance, or brightness, but not color. Are spread out across the whole retina, and dominate when the pupil is large, i.e. night vision. Less color is seen at night. The response is not linear, but logarithmic. The appearance of an object s intensity depends on the surroundings; the sensation is relative and not absolute. Three kinds of cones red-sensitive r() green-sensitive g() blue-sensitive b() CIE standard (Commission Internationale de L Eclairage, 1931) b=435.8nm wavelength r=700nm g=546.1nm In order to standardize the description of color, a large number of people were instructed to say what combination of basic colors a certain color sample consisted of in standard lighting. This resulted in the color matching curves, i.e. transform r(),(),() g b x(),(),() y z Patrick Karlsson 3
Color perception Different spectra can result in identical sensations, called metamers Color perception results from the simultaneous stimulation of 3 cone types (trichromat) Our perception of color is affected by surrounding effects and adaptation standard lightsource object reflectance CIE 1931 standard observer s( ) r( ) z x x y x = CIE XYZ values X=14.27 Y=14.31 Z=71.52 400nm 700nm 400nm 700nm 400nm 700nm X = s( ) r( ) x( ) d Y = s( ) r( ) y( ) d Z = s( ) r( ) z( ) d Each color is represented by a point (X,Y,Z) in the 3D CIE color space. The point is called the tristimulus value. Projection of the CIE XYZ-space RGB/CMY color space Perceptual equal distances RGB - for additive color mixing, e.g. computer screen. CMY - for subtractive color mixing, e.g. printing or painting. RGB space RGB Three components: red (R) green (G) blue (B) Patrick Karlsson 4
Mixing light and mixing pigment Mixing light and mixing pigment Additive Subtractive green yellow yellow cyan red green red magenta blue magenta blue cyan R G B C M Y (K) R C G = M R+B+G=white (additive) R+G=Y [] B 1-[] Y C+M+Y=black (subtractive) C+M=B etc... (CMYK common in printing, where K is black pigment) RGB within CIE XYZ-space HLS color space Hue Lightness Saturation Hue=dominant wavelength, tone Lightness=intensity, brightness Saturation=purity, dilution by white Important aspects: Intensity decoupled from color Related to how humans perceive color HLS space L Hue (Swedish färgton ) Three components: hue (H) brightness (L) saturation (S) Limitation: if S ~ 0, then H undefined cyan green blue yellow H red magenta S Patrick Karlsson 5
HLS Segmentation of the H image YIQ color space Y= Lightness I= Inphase = amount red-green Q= Quadrature = amount blue-yellow Optimised for transmission (TV broadcast). Compatible with BW monitors (use only Y component) Human eye is more sensitive to variations in lightness than variations in hue and saturation and more bandwith (bits) is used for Y. NCS color description NCS=Natural Color System A psychological more than a physiological description of color. Common among artists, designers etc. 20 b w 2060-R50B= 20% white 60% black red with 50% blue 40 60 c Color is relative Hjärnan är lättlurad grön lila gul blå svart It is easy to trick the brain green purple yellow blue black Patrick Karlsson 6
Non-existing colors (without use of psychadelic drugs) Blind spot; look at left cross with your right eye Color context Shape context Chromatic adaption Patrick Karlsson 7
Mach bands Gamma correction Most displays have non-linear intensity scales. The most common correction method is called gamma correction (usually implemented with a lookup table) Sometimes in computer graphics this effect is exaggerated to compensate for the adaptation of the eye. True-color frame buffer Indexed-color frame buffer Store R,G,B values directly in the frame buffer. Each pixel requires at least 3 bytes => 2^24 colors. Store index into a color map in the frame buffer. Each pixel requires at least 1 bytes => 2^8 simultaneous colors. Enables color-map animations. Different blending versions (how to combine color values) Additive blending C=A+B e.g. combining light Subtractive blending C=A-(1-B) e.g. filter effect Patrick Karlsson 8
Average blending C=(A+B)/2 or C=uA+vB e.g. for anti-aliasing Multiplicative blending C=A*B e.g. combining light and matter Patrick Karlsson 9