54
CAP 4703 CAP 4703 Computer Graphic Computer Graphic Methods Methods Prof. Roy Levow Prof. Roy Levow Lecture 1 Lecture 1

CAP 4703 Computer Graphic Methods

  • Upload
    acacia

  • View
    38

  • Download
    0

Embed Size (px)

DESCRIPTION

CAP 4703 Computer Graphic Methods. Prof. Roy Levow Lecture 1. Computer Graphics. Broadly concerned with producing images by computer Many applications Still image generation and editing Animation and film, Computer games Design Scientific and medical data visualization - PowerPoint PPT Presentation

Citation preview

Page 1: CAP 4703 Computer Graphic Methods

CAP 4703CAP 4703Computer Graphic Computer Graphic

MethodsMethodsProf. Roy LevowProf. Roy Levow

Lecture 1Lecture 1

Page 2: CAP 4703 Computer Graphic Methods

Computer GraphicsComputer Graphics

Broadly concerned with producing Broadly concerned with producing images by computerimages by computer

Many applicationsMany applications– Still image generation and editingStill image generation and editing– Animation and film, Computer gamesAnimation and film, Computer games– DesignDesign– Scientific and medical data visualizationScientific and medical data visualization– Simulation and Virtual realitySimulation and Virtual reality– Publishing, …Publishing, …

Page 3: CAP 4703 Computer Graphic Methods

Graphical SystemGraphical System

Main ComponentsMain Components1.1. ProcessorProcessor

2.2. MemoryMemory

3.3. Frame BufferFrame Buffer

4.4. Output DevicesOutput Devices

5.5. Input DevicesInput Devices

Page 4: CAP 4703 Computer Graphic Methods

Processor and MemoryProcessor and Memory

Depending on the application, the Depending on the application, the system can range fromsystem can range from

Capable personal computerCapable personal computer

to ato aSuper-computerSuper-computer

Page 5: CAP 4703 Computer Graphic Methods

Image OutputImage Output Images may beImages may be

– Vector graphicsVector graphicsFormed by drawing lines to create imageFormed by drawing lines to create image

– Raster graphicsRaster graphicsComposed of individual picture elements in Composed of individual picture elements in

an array or an array or rasterIndividual elements are pixelsStored in a frame buffer

Raster graphics is most common– Vector graphics provides better

scalability

Page 6: CAP 4703 Computer Graphic Methods

Graphic System DiragramGraphic System Diragram

Page 7: CAP 4703 Computer Graphic Methods

Frame BufferFrame Buffer NormallyNormally

– Video RAM (VRAM) – designed to Video RAM (VRAM) – designed to support fast transfer of large amounts of support fast transfer of large amounts of datadata

– Dynamic RAM (DRAM)Dynamic RAM (DRAM) Number of bits per pixel is the Number of bits per pixel is the depth

of the frame bufferof the frame buffer– Determines number of distinct color Determines number of distinct color

valuesvaluesB&W=1B&W=1Full color >= 24Full color >= 24

Page 8: CAP 4703 Computer Graphic Methods

Frame Buffer .2Frame Buffer .2

True color systems are also known as True color systems are also known as RGBRGB– Number of bits per pixel is divided by 3Number of bits per pixel is divided by 3– Each group represents one of the colorsEach group represents one of the colors

Red, Green, BlueRed, Green, Blue

ResolutionResolution is the number of pixels is the number of pixels per frame bufferper frame buffer– Usually reported as width x heightUsually reported as width x height

Page 9: CAP 4703 Computer Graphic Methods

Frame Buffer .3Frame Buffer .3

To reduce number of bits per pixel, a To reduce number of bits per pixel, a color buffer may be used– Color buffer holds actual RGB values– Frame buffer holds index into color

buffer– Reduces size when number of colors

used is small relative to total number possible

Page 10: CAP 4703 Computer Graphic Methods

Rasterization ExampleRasterization Example

Page 11: CAP 4703 Computer Graphic Methods

Grapihic ProcessorGrapihic Processor Processing of graphic information Processing of graphic information

may be done bymay be done by– Normal CPUNormal CPU– Specialized Specialized Graphic ProcessorGraphic Processor

High performance graphic display High performance graphic display systems generally use separate systems generally use separate graphic processorgraphic processor– Optimized for image processing and Optimized for image processing and

displaydisplaySpecialized operations and high data Specialized operations and high data

throughputthroughput

Page 12: CAP 4703 Computer Graphic Methods

Output DevicesOutput Devices

Previously, most common output Previously, most common output device was the device was the cathode-ray tubecathode-ray tube or or CRTCRT– Image is created by a moving electron Image is created by a moving electron

beam that causes a coating on the tube beam that causes a coating on the tube face to glow face to glow

– Most commonly CRT scans a line at a Most commonly CRT scans a line at a time across the screentime across the screenBut may be random scanBut may be random scan

Page 13: CAP 4703 Computer Graphic Methods

CRT OperationCRT Operation

Page 14: CAP 4703 Computer Graphic Methods

CRTCRT

The image is not retained but must The image is not retained but must be be refreshedrefreshed (recreated) periodically (recreated) periodically– Most commonly at least 50 times per Most commonly at least 50 times per

secondsecondThis is the refresh rateThis is the refresh rate

Scan lines may be produced Scan lines may be produced consecutively, consecutively, non-interlacednon-interlaced

Or half at a time, Or half at a time, interlacedinterlaced

Page 15: CAP 4703 Computer Graphic Methods

Color CRTColor CRT

Each screen pixel consists of three Each screen pixel consists of three closely spaced color dots, a RGB closely spaced color dots, a RGB triadtriad

Shadow maskShadow mask helps focus electron helps focus electron beam on a single dotbeam on a single dot

Page 16: CAP 4703 Computer Graphic Methods

Color CRT ImageColor CRT Image

Page 17: CAP 4703 Computer Graphic Methods

LCD DisplayLCD Display

Each pixel is a layered solid state Each pixel is a layered solid state device that can be turned on or off to device that can be turned on or off to produce that color componentproduce that color component

Generally cannot support as rapid Generally cannot support as rapid refresh as CRTrefresh as CRT

Page 18: CAP 4703 Computer Graphic Methods

Input DevicesInput Devices

KeyboardKeyboard Pointing devicesPointing devices

– MouseMouse– JoystickJoystick– Game consoleGame console– Data tabletData tablet

Page 19: CAP 4703 Computer Graphic Methods

ImagesImages

Physical imagePhysical image is generated by is generated by physical objectphysical object

Computer graphic systems generate Computer graphic systems generate synthetic imagesynthetic image– Produced by programProduced by program

Page 20: CAP 4703 Computer Graphic Methods

Objects and ViewersObjects and Viewers

World is populated with three World is populated with three dimensional objectsdimensional objects

How object is seen depends on How object is seen depends on relationship to viewer and other relationship to viewer and other attributesattributes

Generally a viewer can see only Generally a viewer can see only some parts of an objectsome parts of an object

Different relationships between Different relationships between object and viewer can produce object and viewer can produce different imagesdifferent images

Page 21: CAP 4703 Computer Graphic Methods

Views of an ObjectViews of an Object

Page 22: CAP 4703 Computer Graphic Methods

Camera System to Define ImageCamera System to Define Image

Page 23: CAP 4703 Computer Graphic Methods

LightLight

Without light all would be uniformly Without light all would be uniformly blackblack

Light makes images visible and Light makes images visible and changes features throughchanges features through– IntensityIntensity– ColorColor– DirectionDirection

Interaction with light is complexInteraction with light is complex

Page 24: CAP 4703 Computer Graphic Methods

Camera withLightCamera withLight

Page 25: CAP 4703 Computer Graphic Methods

Light: Electromagnetic RadiationLight: Electromagnetic Radiation

Page 26: CAP 4703 Computer Graphic Methods

LightLight

Visible spectrum has wavelengths Visible spectrum has wavelengths between 350 nm and 780 nmbetween 350 nm and 780 nm

Color depends on wavelengthColor depends on wavelength– Blue ~450 nmBlue ~450 nm– Green ~520 nmGreen ~520 nm– Red ~650 nmRed ~650 nm

Page 27: CAP 4703 Computer Graphic Methods

Modeling LightModeling Light

Geometric OpticsGeometric Optics– Light assumed to come from point Light assumed to come from point

sourcesource– Fixed intensityFixed intensity– Travels in straight linesTravels in straight lines

Assume monochromatic (single Assume monochromatic (single color)color)

More complex sources can be viewed More complex sources can be viewed as collection of point sourcesas collection of point sources

Page 28: CAP 4703 Computer Graphic Methods

Ray TracingRay Tracing

Effect of light can be viewed by Effect of light can be viewed by following following rayray from source to viewer from source to viewer

Light travels in straight line until it Light travels in straight line until it hits surfacehits surface

Surface point then acts as new point Surface point then acts as new point sourcesource

Ray behavior determined by trig lawsRay behavior determined by trig laws Infinite possibilities but only those Infinite possibilities but only those

that reach viewer matterthat reach viewer matter

Page 29: CAP 4703 Computer Graphic Methods

Ray TracingRay Tracing

Page 30: CAP 4703 Computer Graphic Methods

RadiosityRadiosity

When surface scatters incoming light When surface scatters incoming light in all directions, ray tracing does not in all directions, ray tracing does not produce accurate resultsproduce accurate results– Energy conservation based calculation is Energy conservation based calculation is

more accurate but also more more accurate but also more computationally intensivecomputationally intensive

Page 31: CAP 4703 Computer Graphic Methods

Human Visual SystemHuman Visual System

Light enters eye through Light enters eye through lenslens Focused on Focused on retinaretina at back of eye at back of eye Retina contains light sensitive cellsRetina contains light sensitive cells

– Rods – brightness onlyRods – brightness only– Cones – three kinds for three colorsCones – three kinds for three colors– RGB cones allow RGB displays to RGB cones allow RGB displays to

function function Sensitivity is not uniformSensitivity is not uniform

Page 32: CAP 4703 Computer Graphic Methods

Sensitivity CurvesSensitivity Curves

Page 33: CAP 4703 Computer Graphic Methods

Pinhole CameraPinhole Camera

A simple model of a cameraA simple model of a camera– Assumes light enters through a pin holeAssumes light enters through a pin hole

Small enough that only one ray enters in Small enough that only one ray enters in any directionany direction

Page 34: CAP 4703 Computer Graphic Methods

Pinhole Camera ImagePinhole Camera Image

Can calculate point where ray from Can calculate point where ray from point source is projected on back of point source is projected on back of camera ycamera ypp = -y/(z/d), similar for x = -y/(z/d), similar for x

Page 35: CAP 4703 Computer Graphic Methods

Pinhole Camera Image .2Pinhole Camera Image .2

Point at back of camera is called the Point at back of camera is called the projectionprojection of the source of the source

Field or angle of view is angle made Field or angle of view is angle made by triangle from lens to image planeby triangle from lens to image plane

ΘΘ=2 arctan(h/2d)=2 arctan(h/2d)

Page 36: CAP 4703 Computer Graphic Methods

Imaging SystemImaging System

Page 37: CAP 4703 Computer Graphic Methods

Synthetic Camera ModelSynthetic Camera Model

Standard approach for three-Standard approach for three-dimensional computer graphicsdimensional computer graphics

Compute image that would be Compute image that would be captured by bellows cameracaptured by bellows camera– Bellows allows depth of camera to be Bellows allows depth of camera to be

changed as desiredchanged as desired Image is formed on Image is formed on projection planeprojection plane, ,

where back of camera would bewhere back of camera would be

Page 38: CAP 4703 Computer Graphic Methods

Views of Image FormationViews of Image Formation

Page 39: CAP 4703 Computer Graphic Methods

Synthetic Camera ImageSynthetic Camera Image

Page 40: CAP 4703 Computer Graphic Methods

Clipping Window or RectangleClipping Window or Rectangle

Determines the edge boundaries of Determines the edge boundaries of the imagethe image

Page 41: CAP 4703 Computer Graphic Methods

Programmer’s InterfaceProgrammer’s Interface

Visual interfaceVisual interface– Allows image creation by arranging Allows image creation by arranging

visual componentsvisual components Programming interfaceProgramming interface

– Function libraryFunction library– Application Programmer’s Interface (API)Application Programmer’s Interface (API)

Defines available operationsDefines available operations Images build combining operationsImages build combining operations

Page 42: CAP 4703 Computer Graphic Methods

Paint Program InterfacePaint Program Interface

Page 43: CAP 4703 Computer Graphic Methods

Pen-Plotter ModelPen-Plotter Model

Typical of early vector drawing systemsTypical of early vector drawing systems Move pen from point to point drawing lines Move pen from point to point drawing lines

to create imageto create image

moveto(0, 0);moveto(0, 0);

lineto(1, 0);lineto(1, 0);

lineto(1, 1);lineto(1, 1);

lineto(0, 1);lineto(0, 1);

lineto(0, 0);lineto(0, 0);

Page 44: CAP 4703 Computer Graphic Methods

Pen-Plotter ImagePen-Plotter Image

Adding additional lines could produce Adding additional lines could produce the image of a cubethe image of a cube

Page 45: CAP 4703 Computer Graphic Methods

Pen-Plotter ModelPen-Plotter Model

Limited functionalityLimited functionality Difficult to produce three-Difficult to produce three-

dimensional imagesdimensional images

Page 46: CAP 4703 Computer Graphic Methods

Three-Dimensional APIsThree-Dimensional APIs

Synthetic Camera model is commonSynthetic Camera model is common– OpenGLOpenGL– PHIGSPHIGS– Direct3DDirect3D– VRMLVRML– JAVA-3DJAVA-3D

Page 47: CAP 4703 Computer Graphic Methods

3-D API Components3-D API Components

ObjectsObjects ViewerViewer Light SourcesLight Sources Material PropertiesMaterial Properties

Page 48: CAP 4703 Computer Graphic Methods

Primitive ObjectsPrimitive Objects

PointsPoints Line segmentsLine segments PolygonsPolygons TextText CurvesCurves SurfacesSurfaces

Page 49: CAP 4703 Computer Graphic Methods

OpenGL Object DefinitionOpenGL Object Definition

List of components bounded by List of components bounded by function callsfunction calls

A triangleA triangle

glBegin(GL_POLYGON);glBegin(GL_POLYGON);

glVertex3f(0.0, 0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glVertex3f(0.0, 1.0, 0.0);glVertex3f(0.0, 1.0, 0.0);

glVertex3f(0.0, 0.0, 1.0);glVertex3f(0.0, 0.0, 1.0);

glEnd();glEnd();

Page 50: CAP 4703 Computer Graphic Methods

Camera or ViewerCamera or Viewer

Specification requires a number of Specification requires a number of attributesattributes– PositionPosition– OrientationOrientation– Focal lengthFocal length– Film planeFilm plane

Page 51: CAP 4703 Computer Graphic Methods

Camera SpecificationCamera Specification

Page 52: CAP 4703 Computer Graphic Methods

Sequential Design ProcessSequential Design Process

Images are usually generated as a Images are usually generated as a sequence of successively more sequence of successively more refined imagesrefined images

See color plates 1-8 in textSee color plates 1-8 in text

Page 53: CAP 4703 Computer Graphic Methods

Model-Rendering ParadigmModel-Rendering Paradigm

Page 54: CAP 4703 Computer Graphic Methods

Graphic ArchitecturesGraphic Architectures

Display ProcessorsDisplay Processors Pipeline ArchitecturesPipeline Architectures TransformationsTransformations ClippingClipping ProjectionProjection RasterizationRasterization