Computer Graphics Information thanks to a variety of sources – found throughout the notes
Fake or “Foto”? The creators of the Maya software used in many commercial applications today sometimes have a little fun and challenge viewers of their website. Let’s take a look and see if you can tell – which photos are real and which were created inside the computer? http://area.autodesk.com/fakeorfoto
Seeing is NOT Believing… • The web has many photos going around – some are real and some are fake. The fakes can be classified as jokes, hoaxes, or downright fraudulent. Let’s take a look at some images floating around the Internet… Source: “Popular Science”, October 2005 p. 71
Seeing is NOT Believing China on the moon?
Seeing is NOT Believing • Faked photography has a long history – back in the 1870’s, images of dead loved ones were combined with shots of the living taken during seances and passed off as proof of the spirit world. • Today, photographers charge various amounts of money to “touch-up” photos – from something as simple as removing a blemish to as complicated as switching a face from one photo with that of another. • See http://www.popsci.com/popsci/technology/generaltechnology/d6002684e4646010vgnvcm1000004eecbccdrcrd/3.html
How difficult is it to “fake it”? The human eye allows us to spot inconsistencies. Verification experts look for: • Differences in light, shadow, and shading • Perspective that’s not quite right • Incorrect proportions (head too big/small) However, today’s software makes altering reality as easy as a few mouse clicks.
Methods to Combat Fakes • Algorithms to detect disruptions in the digital photo’s binary file • Watermarking photos • Cameras that include info about the photographer’s iris inside the digital print (verifying the image for court) • GOAL: Make it too difficult for the average person to create convincing fakes that would hold up under scrutiny. Then, catch the really bad guys that can do it anyway.
Fake or Photo Sites to Play with… • http://www.museumofhoaxes.com/tests/hoaxphototest.html • http://urbanlegends.about.com/library/bl_image_quiz.htm • http://www.ghoststudy.com/main/fakepage.html
Computer Graphics • So, where did graphics come from? How far back does it go? • 1600’s – Analytic Geometry • 1960’s - Sketchpad
Graphic Images • For our display purposes, graphic images are composed of pixels (picture elements) • These pixels store in them, the color to be represented at that single point in the picture • Nice, but not concise. How about using math?
Vector Graphics / Object-Oriented Graphics • Treat image as a collection of graphic objects (lines, curves, circles, squares, etc.) • Resolution independent and scalable • Easy to edit • Compact Storage
Vector Graphics • Each object is stored by it’s mathematical properties, allowing it to be changed and scaled easily. • A circle can be represented as it’s center and radius point. Change the location of the center or the size of the radius and you change the circle.
Vector Graphics • Each object occupies a separate “layer” which may be moved, scaled, and arranged in different orders • Objects may be deleted and inserted easily.
Comparing… Bit-mapped graphics – painting programs Vector graphics – drawing programs, illustrations programs, 3D Modeling and Rendering programs.
3D Graphics • 3D Graphic programs automate creating images with perspective projection and special effects of lighting and shading. • There are two types of 3D graphics: • Volume Based • Surface Based
Volume Based 3D Graphics • 3D Image defined by voxels • The really good, filled chocolate bunny! • Voxels are 3D picture elements that have location, color, intensity, transparency, and opacity • Completely define the object, inside and out • Used for Scientific Visualization and Modeling
Surface Based • 3D image is composed of objects defined in 3 dimensions • The hollow chocolate bunny – have the outside, but nothing inside • Regular shapes form the facets or components of each object • Rendering involves adding texture, shading, and lighting effects
How do 3D Graphics Work? • There are many issues involved when you add a third dimension to your graphic images. There’s actually a nice summary of these at “How Stuff Works” (see the link below). • http://computer.howstuffworks.com/3dgraphics.htm • Summary and images on the next few slides courtesy of this site! • There is also math and physics involved – take a look at some comments from one of the Pixar artists. • http://www.theverge.com/2013/3/7/4074956/pixar-senior-scientist-derose-explains-how-math-makes-movies-games
How 3D Graphics Work • The computer monitor is a 2D screen – how do you “trick” your users into thinking they are looking at a 3D scene on a 2D screen? With lots of visual cues that have been used by artists for centuries! • What makes a picture 3D?
What makes a picture 3D? • To represent a triangle, you need 3 lines and 3 angles. • To represent a pyramid, you need 5 ines and 6 angles – nearly 2x the information!
Making 2D look 3D • What are some visual cues we use to make our images appear not to be “flat”? • Objects appear smaller if they are farther away • Objects appear in “focus” if they are close and “fuzzy” if they are far away • Colors are less vibrant in the distance • Parallel lines (like a road) vanishes to a single point in the distance
Creating a 3D World • A virtual world is a representation of a small portion of our world inside the computer. Much more is created than a user can see at any given time frame. • Worlds, to be considered “believable” must conform to the rules of our world – physics and math play a large role in computer graphics. • http://www.theverge.com/2013/3/7/4074956/pixar-senior-scientist-derose-explains-how-math-makes-movies-games • What part of the virtual world can you see? • Depends on your “view point”, where you are and what direction you are looking • Distance can be limited
What it really is… • No matter how sophisticated the world, it all boils down to a bunch of colored pixels on a 2D monitor. So, what makes us buy it as real?
Shapes • Computer models are made up of a lot of points, lines, and common shapes. For natural images, many curves are also necessary (there are not a lot of straight lines in nature). The more shapes, the more believable the image.
Surfaces and Textures • To get information in the real world, we can use all our senses. In the virtual world, we can only look at the surface to get our information. Typically, we look for: • Color • Texture • Reflectance • To make images appear “real,” programmers provide a combination of these three features that hopefully allow their imitation to mimic real life.
Importance of Surface/Texture • Look around – texture for a table top is different from a mirror is different from plastic is different from aluminum. • Mathematical models exist to mimic hundreds of surface types (wood, metal, fog, reptiles, etc.) For realistic color: • Should have millions of colors to make up pixels of image • Use mathematical models for surfaces • Use texture maps People associate qualities that we can't see -- soft, hard, warm, cold -- with particular combinations of color, texture and reflectance. If one of them is wrong, the illusion of reality is shattered.
Lighting and Perspective • Once you have a model, you have to figure out where the light comes from! • Popular models include ray tracing and radiosity. • Why is light important? • No light – you can’t see anything! • Light give you clues to weight and solidness through shading and shadows. • Lighting provides depth clues.
Lighting and Perspective • Perspective describes how objects converge off in the distance. Most 3D graphics use a “single point perspective” where things converge to a point in the “distance.”
Depth of Field • Another optic trick is that things further away appear to be fuzzy – things close to the viewer are in focus.
Anti-aliasing • Curved surfaces (like those found most often in nature) cause a condition called “the jaggies” on computer screens • To fool your eyes into not seeing the jaggies, the computer adds graduated shades of the color in the line to the pixels surrounding it.
Surface Based 3D Graphics Image is created in stages • Model description • Scene description • Rendering
Surface Based Modeling • Objects can be composed of facets shaped from polygons. • Objects can be “wireframe” – a series of lines and points that make up an object
Scene Description • Once we have our objects, we must arrange them to form a scene. Objects are placed using a “world view” coordinate system. Once they are placed into the scene, we must calculate our surfaces, colors, textures, and backgrounds. (Rendering)
Rendering Techniques • Lambert Shading • Gouraud Shading • Phong Shading • Ray-Tracing • Radiosity
Rendering Techniques Lambert Shading • “Flat Shading” • This is a very simple lighting model. Using this model, each facet in the model is treated as if it were flat and every pixel that is a part of the facet is treated in the same way. It’s a fast technique to give the general idea of the scene.
Rendering Techniques Gouraud Shading • Accounts for lighting affects of surrounding surfaces and then calculates the shade of each facet from each of the facet's vertices. After finding the appropriate shade at all vertices of the facet, these values are interpolated to create a smoother effect. This technique is still fast, like the Lambert shading, but more realistic. Specular reflections and highlights are not handled well by this technique, however.
Gouraud Shading Example The facetted appearance of a Lambert shaded model is due to each polygon having only a single color. To avoid this effect, it is necessary to vary the color across a polygon:
Rendering Techniques Phong Shading • Recomputes the illumination model for the scene for each pixel. This technique handles reflection and highlights well but is much more time consuming.
Shading Examples Lambert Wireframe Phong Gouraud
Techniques toward Realism • Brute Force • Fractals and L-Systems (and Example) • Particle Systems "No one can have a well-rounded education without some knowledge of what goes on in the physical world around us. He must have some orderly information about the world and its multitude of animal wayfarers. They have helped define our culture, our arts, our behaviorism and, indeed, the fundaments of our human civilization." -- Walt Disney
Brute Force • Just what is sounds like – we “forcefully” and achingly draw every detail of the scene • Most traditional and costly technique • Models each object in a scene with simple polygons. • a simple cube would require six polygons (one for each side of the cube) • Consider modeling something like the fur on an animal, feathers on a bird, scales on a fish or reptile, etc., one would conceivably have to create hundreds of thousands of polygons for each animal. • This is the most expensive way to address the problem of realism and tends to result in images that look brittle.