Taku Komura Computer Graphics & VTK 1 Visualisation : Lecture 2
Computer Graphics:
Visualisation – Lecture 3 Taku Komura tkomura@inf.ed.ac.uk Institute for Perception, Action & Behaviour
Computer Graphics: Visualisation Lecture 3 Taku Komura - - PowerPoint PPT Presentation
Visualisation : Lecture 2 Computer Graphics: Visualisation Lecture 3 Taku Komura tkomura@inf.ed.ac.uk Institute for Perception, Action & Behaviour Taku Komura Computer Graphics & VTK 1 Visualisation : Lecture 2 Last lecture
Taku Komura Computer Graphics & VTK 1 Visualisation : Lecture 2
Visualisation – Lecture 3 Taku Komura tkomura@inf.ed.ac.uk Institute for Perception, Action & Behaviour
Taku Komura Computer Graphics & VTK 2 Visualisation : Lecture 2
– computer graphics are our tool in visualisation
– to know some computer graphics (this lecture)
Taku Komura Computer Graphics & VTK 3 Visualisation : Lecture 2
– object representation
(geometry)
– object illumination
(lighting)
– camera model
(vision)
— world to image plane projection — rendering: converting
graphical data into an image
3D scene (e.g. real world)
Object with surfaces Light Source(s) Camera Model Rendering
Taku Komura Computer Graphics & VTK 4 Visualisation : Lecture 2
– illumination
— Ambient — Diffuse — Specular
– Shading – Lighting and surface shape perception
Taku Komura Computer Graphics & VTK 5 Visualisation : Lecture 2
– polygons formed of edges & vertices – vertex: positional point (2D or 3D) – edge: joins 2 vertices – polygon: enclosed within N edges
— polygons share common edges
– mesh: set of connected polygons forming a
Hierarchy of Surface Representation
Taku Komura Computer Graphics & VTK 6 Visualisation : Lecture 2
(close up)
fastest to draw
–
modern graphics cards : 20-225 million + triangles per second
Taku Komura Computer Graphics & VTK 7 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 8 Visualisation : Lecture 2
– set of vertices in ℝ3
– polygons reference into vertex set
— implicitly define edges
–
e.g.
vertex 0 0 0 vertex 0 1 0 .... polyon 3 2 1 3 polyon 3 5 6 8 ...
#VRML V1.0 ascii # Separator { Material { ambientColor 0.2 0.2 0.2 diffuseColor 1.0 1.0 1.0 } Coordinate3 { point [ 4.455030 -1.193380 1.930940, 4.581220 -1.506290 1.320410, 4.219560 -1.875190 1.918070, 3.535530 1.858740 -3.007500, 3.793260 1.185430 -3.034130, 4.045080 1.545080 -2.500000, 3.510230 3.468900 0.803110, 3.556410 3.514540 0.000000, 3.919220 3.078210 0.405431, .... .... IndexedFaceSet { coordIndex [ 0, 1, 2, -1, 3, 4, 5, -1, 6, 7, 8, -1, 9, 10, 11, -1, 12, 13, 14, -1, 15, 16, 17, -1, 18, 19, 20, -1, 21, 22, 23, -1, .... ....
Taku Komura Computer Graphics & VTK 9 Visualisation : Lecture 2
– The sum of 3 illumination terms:
Light source
(here point light source)
surface normal (specifies surface orientation)
'Virtual' camera
Taku Komura Computer Graphics & VTK 10 Visualisation : Lecture 2
–
Light from the environment
–
light reflected or scattered from other objects
–
simple approximation to complex 'real-world' process
–
Result: globally uniform colour for object
— Rc = resulting intensity curve — Lc = light intensity curve — Oc = colour curve of object
Uniform Light source
c c
= =
c c c
=
Example: sphere
Taku Komura Computer Graphics & VTK 11 Visualisation : Lecture 2
–
considers the angle of incidence of light on surface
(angle between light and surface normal)
–
Result: lighting varies over surface with orientation to light
Infinite point light source
c n n c
= −
=
θ
No dependence on camera angle!
Example: sphere (lit from left)
Taku Komura Computer Graphics & VTK 12 Visualisation : Lecture 2
–
specular intensity n = shiny reflectance of object
–
Result: specular highlight on object
Rc = colour curve Rn = camera position S (Reflection)
Infinite point light source
No dependence on object colour.
c n n c
O L O L
= −
=
Colour Object ) ( cos Colour Light
θ
Taku Komura Computer Graphics & VTK 13 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 14 Visualisation : Lecture 2
– for relative weights wa, wd, ws – also specular power n
Taku Komura Computer Graphics & VTK 15 Visualisation : Lecture 2
– Flat Shading (once per polygon) – Gouraud shading (for all the vertex of the polygon) – Phong Shading (all the points)
Taku Komura Computer Graphics & VTK 16 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 17 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 18 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 19 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 20 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 21 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 25 Visualisation : Lecture 2
Perpendicular to light
Taku Komura Computer Graphics & VTK 26 Visualisation : Lecture 2
Edge of highlight
Taku Komura Computer Graphics & VTK 27 Visualisation : Lecture 2
Edge of highlight
Taku Komura Computer Graphics & VTK 28 Visualisation : Lecture 2
– improve perception of surface shape features (e.g. nose) – ... but only where the highlight occurs
Taku Komura Computer Graphics & VTK 29 Visualisation : Lecture 2
– We can
— dynamically change the specular power, — Rotate the light — Rotate the viewpoint
to enhance the perception of the shape >> changing the edge of the highlight
Taku Komura Computer Graphics & VTK 30 Visualisation : Lecture 2
Taku Komura Computer Graphics & VTK 31 Visualisation : Lecture 2
Object A’s Coordinate System 3D (x,y,z) Object B’s Coordinate System 3D (x,y,z)
Object Coordinates
World Coordinates
3D (x,y,z)
Object A’s Transform Objects B’s Transform
Display transform
2D (x,y) Camera transform
1
View Coordinates
1
Display Coordinates
transformations and rotations in ℝ3
transformation (perspective projection).
Taku Komura Computer Graphics & VTK 32 Visualisation : Lecture 2
View angle
Front Clipping Plane
Direction of Projection
–
all rays into camera go through a common point
–
bound by clipping planes (front, back); by camera view angle (top, bottom)
–
clipping planes eliminate data that is too near or too distant from camera
Back Clipping Plane View Frustrum
Taku Komura Computer Graphics & VTK 33 Visualisation : Lecture 2
– representing object geometry as polygon meshes – illumination models (ambient, diffuse, specular) – Shading models (flat, Gouraud, Phong) – camera model & projection