Computer Graphics 1, Fall 2005 Computer Graphics 1, Fall 2005 Patrick Karlsson Ingela Nyström Erik Vidholm Anders Hast Filip Malmberg patrick@cb.uu.se ingela@cb.uu.se erik@cb.uu.se aht@hig.se filip@cb.uu.se IT-institutionen, TDB Computer Graphics 1 What is Computer Graphics (CG)? What can CG be used for? What will we learn in this course? What is a digital image? Ingela Nyström 1
Number of picture elements Number of grey-levels Zindy Lena Cell image analysis Medical images: CT, MR Ingela Nyström 2
Classifying aerial images Aerial image of trees Agricultural applications Analysis of paper fibres What is Computer Graphics (CG)? Creating and displaying graphics and images with the aid of a computer This can be almost anything, but usually starts with an abstract representation of numbers and ends with something that we can see What can CG be used for? Visualization of data Medicine, science, economics,... Working tool Graphical User Interfaces (GUIs), VR,... Entertainment Computer games, film, art, Part in telecommunication Compression, decompression Ingela Nyström 3
Computer Graphics vs Image Analysis They are (almost) each others inverses In Computer Graphics, we start with a some numbers and parameters and end with an image In Image Analysis, we start with an image and end with some numbers What will we learn in this course? How to draw images on a computer screen: points, polygons, objects How to create a 3D impression despite our restriction to flat screens How to move around in a virtual 3D world Some tools for modelling a 3D world A brief introduction to the OpenGL Application Programmer s Interface (API) What we will not learn in this course Esthetical aspects of CG How to use 3D-studio, Lightwave, Renderman, How to render photo realistic images (off-line rendering) X, DirectX, SDL, Java3D, and all other APIs out there Older APIs: GKS, PHIGS, etc. Hardware stuff http://www.it.uu.se/edu/course/homepage/grafik1/ht05/ 14 Lectures 4 Computer laborationer This is time for coding the assignments 4 Assignments They give bonus points on the exam This is probably the major part of the work A fairly easy exam If you have done the assignments, this will hardly be of much trouble View volume The fast forward version The Graphics Pipeline Lightsource View plane Hidden surface 3D Projection 2D Camera or observer Rasterization Transformation Shadow Clipping Ingela Nyström 4
Polygon in The Display Pipeline The order may vary somewhat... Images in a computer... 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... 94 100 104 119 125 136 143 153 157 158 103 104 106 98 103 119 141 155 159 160 109 136 136 123 95 78 117 149 155 160 110 130 144 149 129 78 97 151 161 158 109 137 178 167 119 78 101 185 188 161 100 143 167 134 87 85 134 216 209 172 104 123 166 161 155 160 205 229 218 181 125 131 172 179 180 208 238 237 228 200 131 148 172 175 188 228 239 238 228 206 161 169 162 163 193 228 230 237 220 199 just a large array of numbers 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 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 Ingela Nyström 5
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 New course Spring 2006: Advanced Computer Graphics and Visualization Computer Graphics 1, Fall 2005 Ingela Nyström 6