1 angel: interactive computer graphics5e © addison- wesley 2009 image formation fundamental imaging...
DESCRIPTION
3 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole cameraTRANSCRIPT
1Angel: Interactive Computer
Graphics5E © Addison-Wesley 2009
Image FormationImage Formation Fundamental imaging notionsFundamental imaging notions Physical basis for image formationPhysical basis for image formation
LightLight ColorColor PerceptionPerception
Synthetic camera modelSynthetic camera model
2Angel: Interactive Computer
Graphics5E © Addison-Wesley 2009
Elements of Image Elements of Image FormationFormation
ObjectsObjects ViewerViewer Light source(s)Light source(s)
Attributes that govern how light Attributes that govern how light interacts with the materials in the interacts with the materials in the scenescene
Note the independence of the objects, Note the independence of the objects, the viewer, and the light source(s)the viewer, and the light source(s)
3Figures are extracted from Angel's book
(ISBN 0-201-38597-x)
The Human Visual The Human Visual System vs The Pinhole System vs The Pinhole
cameracamera
Human Visual System
Visible Spectrum
Pinhole camera
4Figures are extracted from Angel's book
(ISBN 0-201-38597-x)
The Synthetic-camera The Synthetic-camera ModelModel
Synthetic CameraSynthetic Cameray
(x,y,z)
X
Z
d
Xp, Yp, -d
Synthetic Camera Synthetic Camera Projection GeometryProjection Geometry
Z
X
Y
COP
d
(0,0,0)
x,y,z
x’ = x (d/z)y’ = y(d/z)z’ = d
(x’,y’,z’)
Projection Plane
Projected Point
7 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Models and Models and ArchitecturesArchitectures
8Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Practical ApproachPractical Approach Process objects one at a time in the order Process objects one at a time in the order
they are generated by the applicationthey are generated by the application Can consider only local lightingCan consider only local lighting
Pipeline architecturePipeline architecture
All steps can be implemented in All steps can be implemented in hardware on the graphics cardhardware on the graphics card
application program display
VerticesVertices
Vertices in world coordinatesVertices in world coordinates void glVertex3f(GLfloat x, void glVertex3f(GLfloat x,
GLfloat y, GLfloat z)GLfloat y, GLfloat z) Vertex (x, y, z) sent down the Vertex (x, y, z) sent down the
pipelinepipeline
TransformerTransformer
Transformer in world coordinatesTransformer in world coordinates Must be set before object is drawn!Must be set before object is drawn! glRotatef(45.0, 0.0, 0.0, -1.0);glRotatef(45.0, 0.0, 0.0, -1.0); glVertex2f(1.0, 0.0);glVertex2f(1.0, 0.0);
Complex [Angel Ch. 4]Complex [Angel Ch. 4]
Transformation Matrices Transformation Matrices in OpenGLin OpenGL
Stack
Current
Stack
Current
Load Matrix
Vertices
3DModel
Vertices 3D2D
Modelview Projection
Matrix Mode
12Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
ProjectionProjection Projection Projection is the process that is the process that
combines the 3D viewer with the 3D combines the 3D viewer with the 3D objects to produce the 2D imageobjects to produce the 2D image Perspective projections: all projectors Perspective projections: all projectors
meet at the center of projectionmeet at the center of projection Parallel projection: projectors are Parallel projection: projectors are
parallel, center of projection is replaced parallel, center of projection is replaced by a direction of projectionby a direction of projection
ProjectorProjector
Orthographic ProjectionOrthographic Projection
If d = z - and d
x’ = xy’ = y z = d
x’ = x (d/z)y’ = y(d/z)z’ = d
15Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Primitive AssemblyPrimitive AssemblyVertices must be collected into Vertices must be collected into
geometric objects before clipping geometric objects before clipping and rasterization can take placeand rasterization can take place Line segmentsLine segments PolygonsPolygons Curves and surfacesCurves and surfaces
ClipperClipper
17Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
ClippingClippingJust as a real camera cannot “see” the Just as a real camera cannot “see” the
whole world, the virtual camera can whole world, the virtual camera can only see part of the world or object only see part of the world or object spacespace Objects that are not within this volume Objects that are not within this volume
are said to be are said to be clippedclipped out of the scene out of the scene
18Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
RasterizationRasterization If an object is not clipped out, the If an object is not clipped out, the
appropriate pixels in the frame buffer appropriate pixels in the frame buffer must be assigned colorsmust be assigned colors
Rasterizer produces a set of fragments for Rasterizer produces a set of fragments for each objecteach object
Fragments 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 Vertex attributes are interpolated over objects by the rasterizerobjects by the rasterizer
RasterizerRasterizer
20Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Fragment ProcessingFragment Processing
Fragments are processed to determine Fragments are processed to determine the color of the corresponding pixel in the color of the corresponding pixel in the frame bufferthe frame buffer
Colors can be determined by texture Colors can be determined by texture mapping or interpolation of vertex mapping or interpolation of vertex colorscolors
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
21Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
API ContentsAPI Contents Functions 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
22Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Object SpecificationObject Specification Most APIs support a limited set of Most APIs support a limited set of
primitives includingprimitives including Points (0D object)Points (0D object) Line segments (1D objects)Line segments (1D objects) Polygons (2D objects)Polygons (2D objects) Some curves and surfacesSome curves and surfaces
QuadricsQuadrics Parametric polynomialsParametric polynomials
All areAll are defined through locations in defined through locations in space or space or verticesvertices
23Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
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 object
location of vertex
end of object definition
24Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Camera SpecificationCamera Specification
Six degrees of freedomSix degrees of freedom Position of center of lensPosition of center of lens OrientationOrientation
LensLens Film sizeFilm size Orientation of film planeOrientation of film plane
25Angel: Interactive Computer
Graphics 5E © Addison-Wesley 2009
Lights and MaterialsLights and Materials Types 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
DiffuseDiffuse SpecularSpecular