Title: CSCI 346
1CSCI 346
- Chapter 1 and Chapter 2
- Graphics Systems and Models
- And Graphics Programming
2Agenda
- Homework - assignment 2 is due Friday 02/01/2002
- Finish chapter 1 and start chapter 2
3Homework 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 programs source code is due before next
weeks class 02/01/2002.
4glOrtho (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(No Transcript)
6Imaging Systems
- The human vision system
- Pinhole camera
- Synthetic camera model
7The 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
8Color
- Color results from the interaction of light with
the nervous system - Lens
- Retina
- Color processing unit along the optic nerve
9Lens
- 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
10Lens
- 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
11Retina
- 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,
12Retina
- 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.
13The 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
14The Human Vision System
- VERY complex
- Automatic and instantaneous
- Pattern recognition
- Depth perception
15Pinhole Camera
- Simple model
- Box
- Small pin hole at one side
- Film at the opposite side
16Pinhole 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
17Pinhole Camera
- Problems with pinhole camerathe pinhole
- The pinhole
- Cannot adjust field of view
18Sophisticated 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
19The Synthetic Camera Model
- Equivalent views of image formation
20The Synthetic Camera Model
- Imaging system in figure 1.17bellows camera
- Object and viewer are specified separately
21The 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
22Computer Graphics Programmers 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
23Computer 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
24A Sequence of Images
- Line drawing of a scene
- wireframe
- Flat shading
- One light source flat shading
- One light source smooth shading
- Texture
25Modeling and Rendering
- Modeling
- Rendering
- Sometimes it is good to separate the modeling of
a scene from the production of the file (example
ray tracing)
26Pipeline Architectures
- Pipeline architectures
- Benefit
- Translates well to computer graphics
- Four steps to producing an image
- Transformer
- Clipper
- Projector
- rasterizer
27Chapter 2
28Sierpinski 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
29Pseudocode
- 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
30Pen Plotter
31Problems 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
32Display Funtion
- void display( void )
- typedef GLfloat point22 / define a point
data type / - point2 vertices30.0,0.0,250.0,500.0,50
0.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( k0 klt5000 k)
- jrand()3 / pick a vertex at random /
- / Compute pt halfway between vertex and
old point / - p0 (p0verticesj0)/2.0
- p1 (p1verticesj1)/2.0
- / plot new point /
- glBegin(GL_POINTS)
- glVertex2fv(p)
- glEnd()
-
- glFlush() / clear buffers /
33Coordinate System
3D COORDINATE SYSTEMS
Y
Y
Z
X
X
LEFT HANDED
RIGHT HANDED
Z
34Coordinate 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
35Point To Remember
- We are studying computer graphics
- We are not studying OpenGL
- Wont cover all functions in OpenGL
36Graphics System As a Black Box
Function Calls
Output
User Program
Graphics System
Input/Output Devices
Data
Input
37API Functions
- Primitive functions
- Attribute functions
- Viewing functions
- Transformation functions
- Input functions
- Control functions
383 D Gasket
39OpenGL - 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 doesnt do windows
40OpenGL
- 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
41Related APIs
- GLU (OpenGL utility library)
- Guaranteed to be available
- tesselators
- Quadrics
- NURBs, etc
- Some surprisingly common operations, such as
projection transformations (such as
gluPerspective)
42Related APIs
- GLX or WGL
- Bridge between window system and OpenGL
- Glut
- Portable bridge between window system and OpenGL
- Not standard, but uniformly popular
43Homework
- Finish reading chapter 2 - ICG
- Graphics programming
- Assignment 2 - program due 02/01/2002