CAP 4703 Computer Graphic Methods

Preview:

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

CAP 4703CAP 4703Computer Graphic Computer Graphic

MethodsMethodsProf. Roy LevowProf. Roy Levow

Lecture 1Lecture 1

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, …

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

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

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

Graphic System DiragramGraphic System Diragram

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

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

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

Rasterization ExampleRasterization Example

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

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

CRT OperationCRT Operation

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

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

Color CRT ImageColor CRT Image

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

Input DevicesInput Devices

KeyboardKeyboard Pointing devicesPointing devices

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

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

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

Views of an ObjectViews of an Object

Camera System to Define ImageCamera System to Define Image

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

Camera withLightCamera withLight

Light: Electromagnetic RadiationLight: Electromagnetic Radiation

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

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

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

Ray TracingRay Tracing

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

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

Sensitivity CurvesSensitivity Curves

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

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

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)

Imaging SystemImaging System

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

Views of Image FormationViews of Image Formation

Synthetic Camera ImageSynthetic Camera Image

Clipping Window or RectangleClipping Window or Rectangle

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

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

Paint Program InterfacePaint Program Interface

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);

Pen-Plotter ImagePen-Plotter Image

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

Pen-Plotter ModelPen-Plotter Model

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

dimensional imagesdimensional images

Three-Dimensional APIsThree-Dimensional APIs

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

3-D API Components3-D API Components

ObjectsObjects ViewerViewer Light SourcesLight Sources Material PropertiesMaterial Properties

Primitive ObjectsPrimitive Objects

PointsPoints Line segmentsLine segments PolygonsPolygons TextText CurvesCurves SurfacesSurfaces

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();

Camera or ViewerCamera or Viewer

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

Camera SpecificationCamera Specification

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

Model-Rendering ParadigmModel-Rendering Paradigm

Graphic ArchitecturesGraphic Architectures

Display ProcessorsDisplay Processors Pipeline ArchitecturesPipeline Architectures TransformationsTransformations ClippingClipping ProjectionProjection RasterizationRasterization

Recommended