csc 461: lecture 3 1 csc461 lecture 3: models and architectures objectives –learn the basic...
TRANSCRIPT
CSC 461: Lecture 3CSC 461: Lecture 3 11
CSC461 Lecture 3: CSC461 Lecture 3: Models and ArchitecturesModels and Architectures
ObjectivesObjectives
– Learn the basic design of a graphics systemLearn the basic design of a graphics system– Introduce pipeline architectureIntroduce pipeline architecture– Examine software components for an Examine software components for an
interactive graphics systeminteractive graphics system
CSC 461: Lecture 3CSC 461: Lecture 3 22
Image Formation RevisitedImage Formation Revisited
Can we mimic the synthetic camera model Can we mimic the synthetic camera model to design graphics hardware software?to design graphics hardware software?
Application Programmer Interface (API)Application Programmer Interface (API)–Need only specify Need only specify
ObjectsObjects MaterialsMaterials ViewerViewer LightsLights
But how is the API implemented?But how is the API implemented?
CSC 461: Lecture 3CSC 461: Lecture 3 33
Physical ApproachesPhysical ApproachesRay tracingRay tracing: follow rays of light from center : follow rays of light from center of projection until they either are absorbed of projection until they either are absorbed by objects or go off to infinityby objects or go off to infinity–Can handle global effectsCan handle global effects
Multiple reflectionsMultiple reflections Translucent objectsTranslucent objects
–SlowSlow–Need whole data baseNeed whole data base
RadiosityRadiosity: Energy based approach: Energy based approach–Very slowVery slow
CSC 461: Lecture 3CSC 461: Lecture 3 44
Practical ApproachPractical ApproachProcess objects one at a time in the order they are Process objects one at a time in the order they are
generated by the applicationgenerated by the application–Can consider only local lightingCan consider only local lighting
Pipeline architecturePipeline architecture
All steps can be implemented in hardware on the All steps can be implemented in hardware on the graphics cardgraphics card
application program display
CSC 461: Lecture 3CSC 461: Lecture 3 55
Vertex ProcessingVertex ProcessingMuch of the work in the pipeline is in converting Much of the work in the pipeline is in converting
object representations from one coordinate system object representations from one coordinate system to anotherto another
–Object coordinatesObject coordinates–Camera (eye) coordinatesCamera (eye) coordinates–Screen coordinatesScreen coordinates
Every change of coordinates is equivalent to a Every change of coordinates is equivalent to a matrix transformation matrix transformation
Vertex processor also computes vertex colorsVertex processor also computes vertex colors
CSC 461: Lecture 3CSC 461: Lecture 3 66
ProjectionProjectionProjection Projection is the process that combines the is the process that combines the 3D viewer with the 3D objects to produce the 3D viewer with the 3D objects to produce the 2D image2D image–Perspective projections: all projectors meet at Perspective projections: all projectors meet at
the center of projectionthe center of projection–Parallel projection: projectors are parallel, center Parallel projection: projectors are parallel, center
of projection is replaced by a direction of of projection is replaced by a direction of projectionprojection
CSC 461: Lecture 3CSC 461: Lecture 3 77
Primitive AssemblyPrimitive Assembly
Vertices must be collected into geometric Vertices must be collected into geometric objects before clipping and rasterization can objects before clipping and rasterization can take placetake place–Line segmentsLine segments–PolygonsPolygons–Curves and surfacesCurves and surfaces
CSC 461: Lecture 3CSC 461: Lecture 3 88
ClippingClippingJust as a real camera cannot “see” the whole Just as a real camera cannot “see” the whole world, the virtual camera can only see part of world, the virtual camera can only see part of the world or object spacethe world or object space–Objects that are not within this volume are said to Objects that are not within this volume are said to
be be clippedclipped out of the scene out of the scene
CSC 461: Lecture 3CSC 461: Lecture 3 99
RasterizationRasterization If an object is not clipped out, the appropriate If an object is not clipped out, the appropriate
pixels in the frame buffer must be assigned colorspixels in the frame buffer must be assigned colorsRasterizer produces a set of fragments for each Rasterizer produces a set of fragments for each
objectobjectFragments are “potential pixels”Fragments are “potential pixels”
–Have a location in frame buffferHave a location in frame bufffer–Color and depth attributesColor and depth attributes
Vertex attributes are interpolated over objects by Vertex attributes are interpolated over objects by the rasterizerthe rasterizer
CSC 461: Lecture 3CSC 461: Lecture 3 1010
Fragment ProcessingFragment ProcessingFragments are processed to determine the Fragments are processed to determine the color of the corresponding pixel in the frame color of the corresponding pixel in the frame bufferbuffer
Colors can be determined by texture Colors can be determined by texture mapping or interpolation of vertex colorsmapping or interpolation of vertex colors
Fragments may be blocked by other Fragments may be blocked by other fragments closer to the camera fragments closer to the camera –Hidden-surface removal Hidden-surface removal
CSC 461: Lecture 3CSC 461: Lecture 3 1111
The Programmer’s InterfaceThe Programmer’s InterfaceProgrammer sees the graphics system Programmer sees the graphics system through an interface: the Application through an interface: the Application Programmer Interface (API)Programmer Interface (API)
CSC 461: Lecture 3CSC 461: Lecture 3 1212
API ContentsAPI ContentsFunctions that specify what we need to Functions that specify what we need to form an imageform an image–ObjectsObjects–ViewerViewer–Light Source(s)Light Source(s)–MaterialsMaterials
Other informationOther information–Input from devices such as mouse and Input from devices such as mouse and
keyboardkeyboard–Capabilities of systemCapabilities of system
CSC 461: Lecture 3CSC 461: Lecture 3 1313
Object SpecificationObject SpecificationMost APIs support a limited set of Most APIs support a limited set of primitives includingprimitives including–Points (1D object)Points (1D object)–Line segments (2D objects)Line segments (2D objects)–Polygons (3D objects)Polygons (3D objects)–Some curves and surfacesSome curves and surfaces
QuadricsQuadricsParametric polynomialParametric polynomial
All areAll are defined through locations in space defined through locations in space or or verticesvertices
CSC 461: Lecture 3CSC 461: Lecture 3 1414
ExampleExample
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( );
type of objectlocation of vertex
end of object definition
CSC 461: Lecture 3CSC 461: Lecture 3 1515
Camera SpecificationCamera Specification
Six degrees of Six degrees of freedomfreedom–Position of center of Position of center of
lenslens–OrientationOrientation
LensLensFilm sizeFilm sizeOrientation of film Orientation of film planeplane
CSC 461: Lecture 3CSC 461: Lecture 3 1616
Lights and MaterialsLights and MaterialsTypes of lightsTypes of lights
–Point sources vs distributed sourcesPoint sources vs distributed sources–Spot lightsSpot lights–Near and far sourcesNear and far sources–Color propertiesColor properties
Material propertiesMaterial properties–Absorption: color propertiesAbsorption: color properties–ScatteringScattering
DiffuseDiffuseSpecularSpecular