1 / 43

CSCI 346

CSCI 346. Chapter 1 and Chapter 2 Graphics Systems and Models And Graphics Programming. Agenda. Homework - assignment 2 is due Friday 02/01/2002 Finish chapter 1 and start chapter 2. Homework 2. Convert your 2D object from program 1 to a 3D object. Center it well in your 3D window.

sakura
Télécharger la présentation

CSCI 346

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 346 Chapter 1 and Chapter 2 Graphics Systems and Models And Graphics Programming

  2. Agenda • Homework - assignment 2 is due Friday 02/01/2002 • Finish chapter 1 and start chapter 2

  3. Homework 2 • Convert your 2D object from program 1 to a 3D object. • Center it well in your 3D window. • Use a meaningful window name (not "Susan's picture"). • Remember to document your code. • Movement is not required for this assignment. • Review your code before you submit it. If you see repeated chunks of code, create a function and use it. • Display it using an orthographic projection. • Use my program named 3D picture linked from the bottom of the syllabus as a guide. • This program’s source code is due before next week’s class 02/01/2002.

  4. glOrtho (GLdouble left, GLdouble right, GLdouble, bottom, GLdouble top, GLdouble near, GLdouble far) • Creates a viewing volume with a box shape. • Direction of projection is parallel to z axis. • Viewpoint faces -z axis. • glOrtho (0.0, (GLdouble) w, 0.0, (GLdouble) h, -500.0, 500.0);

  5. Imaging Systems • The human vision system • Pinhole camera • Synthetic camera model

  6. The Human Vision System • Very complex • Light enters the eye through the lens and the cornea • Iris opens and closes to regulate amount of light • Lens forms an image on the retina • Rods and cones are on the retina and are the light sensors and excitable by the visible light spectrum

  7. Color • Color results from the interaction of light with the nervous system • Lens • Retina • Color processing unit along the optic nerve

  8. Lens • Focus the incoming light on the retina, which contains the photo receptors • Lens must adjust to the focal length of the wavelength • Red has the longest focal length • Blue has the shortest focal length

  9. Lens • Focus the incoming light on the retina, which contains the photo receptors • Chromostereopsis • Lens absorbs light, (blue = 2x red) • Fluid between the lens and the retina also absorb light

  10. Retina • Photo receptors that absorb photons and transmit chemical signals to the brain. • Rods. • Night-vision receptors. • No color dependency. • Cones. • Color senstitivity. • Require a higher level of light intensity than the rods. • Clustered in the center of retina,

  11. Retina • We see objects by edge detection, where an edge can be created by a difference in color or brightness or both. • Photoreceptors adjust their sensitivity to the overall light level. • There is also a required minimum intensity level for the photoreceptors to respond.

  12. The Human Vision System • Resolution • The measure of what size objects we can see • How close we can place two points and they remain distinct • Intensity • Physical measure of light energy • Brightness • Measure of how intense we perceive the light to be

  13. The Human Vision System • VERY complex • Automatic and instantaneous • Pattern recognition • Depth perception

  14. Pinhole Camera • Simple model • Box • Small pin hole at one side • Film at the opposite side

  15. Pinhole Camera • Field or angle of view of the camera is the angle made by the largest object that our camera can image on its film plane • Ideal pinhole camera has an infinite depth of view -- every point in the field of view is in focus

  16. Pinhole Camera • Problems with pinhole camerathe pinhole • The pinhole • Cannot adjust field of view

  17. Sophisticated Cameras • Lens replaces a pinhole • Larger lenses admit more light • Choosing a lens with the proper focal length • Equiv to choosing d for the pinhole camera • The angle of view can vary up to 180 degrees • Objects in the field of view may or may not be in focus

  18. The Synthetic Camera Model • Equivalent views of image formation

  19. The Synthetic Camera Model • Imaging system in figure 1.17bellows camera • Object and viewer are specified separately

  20. The Synthetic Camera Model • Image or projection plane in front of the lens • Image of the point on the object is located where the projector passes through the projection plane • Limited size of the image • Angle of view describes the limitation • A clipping rectangle placed in the image plane to limit the size of the image • Blinders on a horse • Underwater goggles • Window into the world

  21. Computer Graphics Programmer’s Interface • Paint program • User friendly interface • Point and click, no programming • Application programmers interface (API) • Interface between an application program and a graphics system can be specified by graphics functions that reside in a graphics library. Specs called API

  22. Computer Graphics API - Specify • Objects • Vertices • Set of primitives • Viewer position • Center of projection (center of the lens) • Orientation -- may be rotated about the origin (center of projection or center of the lens) • Focal length - the size of the image on the film plane • Film plane -- back of the camera has a height and width

  23. A Sequence of Images • Line drawing of a scene • wireframe • Flat shading • One light source & flat shading • One light source & smooth shading • Texture

  24. Modeling and Rendering • Modeling • Rendering • Sometimes it is good to separate the modeling of a scene from the production of the file (example : ray tracing)

  25. Pipeline Architectures • Pipeline architectures • Benefit • Translates well to computer graphics • Four steps to producing an image • Transformer • Clipper • Projector • rasterizer

  26. Chapter 2 • Graphics Programming

  27. Sierpinski Gasket • Pre-Mandelbrot classic • Found by W. Sierpinski around world war I • Generated by recursively dividing a triangle into four congruent smaller triangles • Think of the interior triangles as "holes” • They occupy more and more of the total area, while the "solid" portion becomes as hopelessly fragile

  28. Pseudocode 1. Pick a point at random inside the triangle 2. Select one of the three vertices at random 3. Find a point halfway between the initial point and the randomly selected vertex 4. Display this new point by putting some sort of marker, such as a small circle, at its location 5. Replace the initial point with this new point 6. Return to step 2

  29. Pen Plotter • moveto(x,y) • lineto(x,y)

  30. Problems With Pen-plotter Model • 3D difficult • Must convert 3d world to 2d projection explicitly • OpenGL allows us to focus on building 3D world and let computer handle projections

  31. Display Funtion void display( void ){ typedef GLfloat point2[2]; /* define a point data type */ point2 vertices[3]={{0.0,0.0},{250.0,500.0},{500.0,0.0}}; /* A triangle */ int i, j, k; long rand(); /* standard random number generator */ point2 p ={75.0,50.0}; /* An arbitrary initial point */ glClear(GL_COLOR_BUFFER_BIT); /*clear the window */ /* computes and plots 5000 new points */ for( k=0; k<5000; k++) { j=rand()%3; /* pick a vertex at random */ /* Compute pt halfway between vertex and old point */ p[0] = (p[0]+vertices[j][0])/2.0; p[1] = (p[1]+vertices[j][1])/2.0; /* plot new point */ glBegin(GL_POINTS); glVertex2fv(p); glEnd(); } glFlush(); /* clear buffers */ }

  32. Coordinate System 3D COORDINATE SYSTEMS Y Y Z X X LEFT HANDED RIGHT HANDED Z

  33. Coordinate System in OpenGL • What units are x, y, and z? • Your choice • Device independent • World coordinate system • Before displaying on output device, world coordinates must be converted to device or raster or screen coordinates

  34. Point To Remember • We are studying computer graphics • We are not studying OpenGL • Won’t cover all functions in OpenGL

  35. Graphics System As a Black Box Function Calls Output User Program Graphics System Input/Output Devices Data Input

  36. API Functions • Primitive functions • Attribute functions • Viewing functions • Transformation functions • Input functions • Control functions

  37. 3 D Gasket • Use tetrahedons

  38. OpenGL - What Is It? • A graphics rendering library • API to produce high-quality, color images from geometric and raster primitives • Window system and operating system independent • OpenGL “doesn’t do windows”

  39. OpenGL • Most widely adopted graphics standard • Introduced in 1992 • High visual quality and performance • Industry standard • Stable • Reliable and portable • Evolving • Scalable • Easy to use • Well-documented

  40. Related APIs • GLU (OpenGL utility library) • Guaranteed to be available • tesselators • Quadrics • NURBs, etc • Some surprisingly common operations, such as projection transformations (such as gluPerspective)

  41. Related APIs • GLX or WGL • Bridge between window system and OpenGL • Glut • Portable bridge between window system and OpenGL • Not “standard”, but uniformly popular

  42. Homework • Finish reading chapter 2 - ICG • Graphics programming • Assignment 2 - program due 02/01/2002

More Related