Fundamentals of Computer Graphics INTRODUCTION! Sergio Benini! Department of Information Engineering Faculty of Engineering University of Brescia Via Branze, 38 25231 Brescia - ITALY 1
Overview Here you can find A possible definition of Computer Graphics The scheme of a Computer Graphics application Software tools for Computer Graphics Applications 2
Computer Graphics A possible definition: With the terms COMPUTER GRAPHICS we intend the use of a computer to produce an image (or a sequence of images) As all definitions it is incomplete and vague Topics which are included by this definition are too many (for a single course) In order to better detail the boundaries within which we will move, let us consider some important paradigms of CG 3
History In 1960 W. Fetter introduced the terms Computer Graphics to describe the research he was carrying out at Boeing. He was thinking about exploiting the 3D model of the human body to design the airplane cockpit Perhaps the best way to define computer graphics is to find out what it is not. It is not a machine. It is not a computer, nor a group of computer programs. It is not the know-how of a graphic designer, a programmer, a writer, a motion picture specialist, or a reproduction specialist. Computer graphics is all these a consciously managed and documented technology directed toward communicating information accurately and descriptively. Computer Graphics, by William A. Fetter, 1966 Interactive Computer Graphics was born in 1963 with the PhD thesis by Ivan Sutherland The Sketchpad system uses drawing as a novel communication medium for a computer. The system contains input, output, and computation programs which enable it to interpret information drawn directly on a computer display. Sketchpad has shown the most usefulness as an aid to the understanding of processes, such as the motion of linkages, which can be described with pictures. Sketchpad also makes it easy to draw highly repetitive or highly accurate drawings and to change drawings previously drawn with it... Sketchpad, A Man- Machine Graphical Communication System, by I. Sutherland, 1963 http://www.youtube.com/watch?v=0oonxt-gyju (starting at about 04:30 - ending ~8:30) 4
History 1) Model used by Fetter 2) Sketchpad 5
2D vs 3D The first big division is about dimensions 2D Graphics: to this category belongs all graphics which employ only 2 dimensions, typically the bidimensional screen space. It is the most simple since there exists a biunivocal correspondence between the space to represent and the physical space of the screen 3D Graphics: in this case a tridimensional model is built and projected on the bidimensional screen space. Operations (conceptual and concrete) are complicated by this projection, but more interesting results are obtained More than 3 dimensions are rarely used; color can be representative of a fourth dimension. However, in general, such images can be difficulty interpreted and are scarcely used. 6
2D vs 3D 3) 2D image 4) 3D image 7
Photorealism Vs Non-Photorealism One computer image, depending on the use, has to seem either real (as if it was taken with a camera), or simplified and artificial If the purpose of the image is to transmit information, this aim is more effectively reached by a simplified image Algorithms to obtain photorealistic images (radiosity, ray-tracing, etc.) are computationally demanding For non-photorealistic images good results can be obtained by simple and fast algorithms Applications requiring non-photorealistic images which are nevertheless computationally demanding do exist, e.g. cartoons There is NOT however a sharp boundary between artificial and photorealism; what can seem enough photorealistic in one application, can be too artificial for another one 8
Photorealism VS Non-Photorealism 5) Photorealism ( H.W. Jensen) 6) Non-Photorealism (by Gooch et. al.) 9
Interactive Vs Non-Interactive Computer generated graphic can be interactive, that is it can allow an external user to interact real-time with one or more parameters regarding the graphic representation In the case of interactive graphics real-time responses to user commands are required; this implies the need of particular hardware (graphic accelerator boars, powerful processor, memory) a simplified model of rendering (usually interactive applications are not photorealistic) With non-interactive graphics, the quality of images can reach very high levels, and the only limit is given by the time needed for their generation Both graphic types are interesting and have different applications, often complementary 10
Interactive Vs Non-Interactive 7) Interactive (Fly 2k Gathering of Developers, Inc.) 8) Non-interactive (Stuart Little Columbia Pics) 11
Physic model Vs tricks In the case of photorealist images there is another categorisation: image can seem to be true since either it has been obtained with realistic algorithms of interaction between materials and light, or because it has been obtained by using tricks Without generalising too much, we can say that more the interaction is important in one application, more the application has to divert from reality and some tricks for appearance have to be applied In the last years, however, thanks to the development of hardware, this distinction is becoming weaker and weaker 12
Scheme of a graphic application In general the graphic applications we will deal with can be represented by the following scheme There is a description of any type (procedural or not) of the world that has to be represented: this process is called modeling From the description (model), a 2D-image is obtained: this process is globally called rendering The sequence of algorithms that implement the rendering is called graphic pipeline The obtained image is finally visualised on the screen (e.g. for interactive applications) or saved to file World representation model Graphic pipeline rendering Final image 13
Scheme of a CG application The description of the world that feeds the graphic pipeline consists usually in three elements: 1. OBJECTS of the world: they can be real objects (cubes, robot, apples, ) or data (points in the 3D space, iso-surfaces, ). Objects have positional properties (their position, orientation, etc.) and appearance ones (colour, how is the surface, if they reflect light or not, etc.) 2. LIGHTS that determine the illumination properties of the world; they have positional properties, but have not appearance ones 3. THE OBSERVER implements a virtual camera which generates a 2D image (the screen) of the 3D description of the world. He/she also has positional properties, but no appearance 14
Modeling Process The model of an object can be obtained in three ways: Manual, that is it is drawn by means of a graphic tool objects (e.g. http://www.blender.org/ offers, among the others, manual modeling functionalities). Usually complex objects are obtained by combining simple objects (see http://www.blender.org/features/ and demo reel) Automatic, from tools (e.g. scanners) that allow to acquire the digital model from a real object. Other techniques which are based on the object images are studied in Computer Vision, and lately also in Computer Graphics. This is usually called Image-based modeling (ex http://insight3d.sourceforge.net/) Procedural, that is the object is created by a procedure. A typical example are fractal objects, which have various application in CG, or geometric objects, such as spheres, cubes, regular polyhedrons, etc. For example a sphere is obtained by specifying the radius and the center position, and then it is drawn by a procedure which computers its analytic equation. Complex sw for 3D modeling adopt this solution (e.g. http://www.procedural.com ) Different techniques can be also combined together 15
Modeling Process 9) Manual 10) Automatic 11) Procedural 16
Rendering Process On the base of these information, a certain number of steps has to be done to obtained the desired image Projection: to project (geometrically) the scene from the 3D space to the 2D screen of the virtual camera Shading: for each image point, its colour has to be determined as a function of the object surface and its orientation, of lights position, and (in the so called global models) of the indirect light reflections by other surfaces Removal of Hidden Surfaces: elements closer to the camera cover the further ones: we shall determine which surfaces are visible and which are not Rasterisation: when we know which colour to assign to every image point, the final step is mapping this information on the display (i.e. switching pixels on) 17
Modeling Vs Rendering In a computer generated image (3D or 2D, interactive or not), two elements are essentials Geometric models of objects (or data) Their colour, shadow, texture characteristics etc. which are named shading Often it is practically impossible to obtain an object model with the desired details; in such a case, details can be added during the rendering phase (by changing the shading) In general it is a waste of resources to build a complicated model when it is possible to reach the same effect with a simpler model and an proper shading 18
Modeling Vs Rendering 12) Model 13) Model + shading 19
Hardware elements Here we just list the main hardware elements in a modern computer graphic application Raster display: it consists on a matrix of picture elements (pixels) which switch on if they are hit by an electronic beam (similarly to a TV). The principal features are: resolution, that is the matrix dimension, and the colour depth, that is how many bit are associated to each pixel to represent the colour information: 8 bit=256 colours, 24 bit (o truecolour)=~32 mil colours Frame buffer: it is the memory portion that contains the image (an array of values for pixels) which is directly modified by the graphic application Video controller: it reads the frame buffer and builds the image on the screen Display processor (or graphics controller): optional element, usually inserted in dedicated graphic boards, which contains the memory for the frame buffer (thus freeing the main memory) and performs some graphic operations (thus relieving the CPU) such as the scan conversion (which is the digitalisation of image) 20
Hardware 21
Software tools for computer graphics Graphic Libraries: most commons are OpenGL (Silicon Graphics, Inc,) and Direct3D (Microsoft). At a higher level wrt OpenGL we have Performer (SGI), a toolkit to develop real-time video simulations, virtual reality, interactive entertainment and other high performing applications of 3D graphics Rendering applications: usually they produce photorealistic images from a procedural description of the world (typically an ASCII file). The most common freeware applications are PovRay, Rayshade and BMRT. The last one implements a largely used standard: RenderMan interface Modeling tools: they are professional tools, usually very expensive, which allow to interactively build 3D models to use in CG applications Suite of integrated tools: these packages typically include a modeling application and one or more integrated programs for rendering. The most popular are 3D Studio MAX, LightWave, TrueSpace, Maya and Blender, which is free, multi-platform and quite performing suite 22
Applications In the last years we experienced large improvements in the processor speed and memory capacity, while prices of graphic boards and in general electronic devices are constantly decreasing These factors have determined a fast grow of computer graphics applications; in only 10 years resolutions have grown from 320x240 pixels with 16 colours up to 1024x1024 pixels with 32 millions of colours While once, advanced computer graphics applications were limited to research institutes (often for military use), now CG is used in all applications available for computers of all ranges A list of possible applications of computer graphics follows (some will be discussed in more detail later on) 23
Human Computer Interaction Graphics is lately of great help for human computer interaction It is easy to understand It provides a larger number of information in a faster way It catches user attention In general graphic interfaces must satisfy the following criteria Different levels of ability: different ways of achieving the same result Coherence: same functionalities must be accessible in the same way Back up and error safe: provides a way to correct users errors Feedback: notify the user of what is happening during the interaction 24
Human Computer Interaction An example of advanced graphical interface is given from operating systems, which evolved from a text interface to a graphical one (windows, icons); they are typically bidimensional (even if sometimes they give the impression to be 3D) 14) Mac OS X (1984) 15) X-Windows 25
Human Computer Interaction Other graphical interfaces for human computer interaction CAD (Computer Aided Design), for technical design (2D and 3D) Internet websites, both to catch the attention of the user while browsing a website, and to allow a better interaction with information and data in the network (menus, buttons, rollover, etc) Augmented and Virtual Reality, which allow the user to be surrounded, partially or completely, by the application, being able to interact with data and information in a natural way. These are still costly techniques and not very common Controls for vehicles or tools, where a user uses a graphical interface to access functionalities of a complex tool or of a vehicle, both while reading data and for sending commands; an example is a glass cockpit, which is a graphical representation of board instruments of an aircraft and that are substituting more traditional flight instruments 26
Virtual Reality Examples of virtual reality 16) Lamp and chairs are synthetic objects ECRC 17) Wireframe model of the shuttle hold overimposed on the image U. Toronto 27
Other visualisations Scientific Visualisation It is the meeting point between computer graphics and the analysis of scientific data Among possible uses: medical images, mathematical plots, experimental data, simulation results, etc Information Visualisation Topic close to the previous one, it deals with abstract data which cannot be immediately visualised without the introduction of a proper visual metaphor (es. visualisation of log files, of tube maps, etc ). See for example http://d3js.org/ or http://prefuse.org/ Example: Trace Visualizer (Tvi) by A. Boschetti (former TA of this class) http://www.ing.unibs.it/ntw/tools/tvi/index.php 28
Trace Visualizer (Tvi) 29
Information Visualisation 21) Vis. Info ( M. Ward) 22) Meteorology ( NCAR) 23) Collision of two neutron stars ( NCSA) 30
Artistic use Images have been always used to catch attention and to express feelings, sensations, emotions. Computer graphics is particularly used for: Computer Art, used to express states of affection Advertisement, to catch people attention with images Movies, either in the case it is used for special effects (most of the cases) or when it is used to product the whole film (few cases, but lately more and more frequent) 31
Artistic use 32
Videogames It is an extremely serious research filed (and complex as well!); many algorithms of modern computer graphics were born thanks to computer games. Also the improvements in processor and memory performances are connected to the videogame growth in last decades Some advanced elements of modern videogames 3D Real-time graphics Complex human computer interface Advanced graphic algorithms (shadows, hierarchical data structures, light effects, particle systems, raytracing, radiosity, etc) Advanced graphic boards Extreme photorealistic scenes 33
Videogames 34