Professional Documents
Culture Documents
Ruth Aylett
Overview
VE Software
Graphics for VEs
The graphics pipeline
Projections
Lighting
Shading
VR software
Runtime VR systems
Initialisation
executed once at program start-up time
generates or loads a run-time world database containing
description of all entities in the virtual world.
Cyclic executive
Check and
initialise
hardware
Import or
create
3D world
Create
view
points
Software architecture
Render
world
Check
input
devices
Main loop
Updating state:
reading values from input devices
applying those values to the objects being controlled by each
device
(including the participant's viewpoint or body positions).
Game Engines
Graphics Pipeline
3D
DATA
TRANSFORM
3D DATA IN
CAMERA
COORDS
TRANSFORM
2D DATA IN
SCREEN
COORDS
DATA
FULLY ON
SCREEN
Scene Description
Z
World
Cartesian Coordinates
2 Dimensions (X,Y)
3 Dimensions (X,Y,Z)
Y
X
Objects
Shape
Colour
Location
X
Object Representation
POINTS
LINES
POLYGONS
MESHES
(X,Y,Z)
(X1,Y1,Z1), (X2,Y2,Z2)
(X1,Y1,Z1) (Xn,Yn,Zn)
Set of Vertices V1 = (X1,Y1,Z1) Vn = (Xn,Yn,Zn)
Set of Polygons P1, P2, Pm
Each Polygon Pm is represented as ordered list
of vertices
Object Colour
RGB System
Red - Green - Blue
Additive Light System
Colour Represented as (R,G,B)
blue
Examples
(1, 1, 0) Yellow
(0, 0, 0) black
(1, 1, 0) green
red
green
Building a World
Transforming objects
Translation
Add an off set to every vertex on an object
Rotation
Use trigonometry to calculate new position of each
vertex
Allow rotation around each cartesian axis
May be represented as matrices
Scale
Multiply each vertex by constant scale factor
Always apply before object put into scene
Translation
An object is translated by adding an offset to every vertex
Y
(x+Tx, y+Ty)
(x, y)
(Tx, Ty)
X
(X, Y)
(X1, Y1)
a
X
(X1, Y1) =
cos(a) - sin(a)
sin(a) - cos(a)
cos(a) -sin(a)
sin(a)
cos(a)
cos(a)
sin(a)
-sin(a)
cos(a)
Y Rotation
(X1, Y1, Z1) =
Z Rotation
cos(a) -sin(a)
Projection
eye
World
World
Clipping
screen
Screen
Method
Painters algorithm
Z-buffer algorithm
Method:
Illumination Model
Phong Model
Diffuse Reflection
Mathematical Description
N
normal to object at intersection
Li vector from intersection to light
Ii
intensity of light from light I
Kd coefficient of diffuse reflection
ai
angle between Li and N
N
a
eye
Object
Specular Reflection
Mathematical Description
ks
Li
Ii
R
n
eye
Light Sources
Illumination Model
Partial Illumination Model
Ambient light
Ambient light
diffuse reflections
single source, ks= 0
Object Shading
Flat Shading
Gouraud Shading
Phong Shading
Object Shading
Flat Shading
Gouraud Shading
Phong Shading
Flat
(R2,G2,B2)
(R1,G1,B1)
(R3,G3,B3)
Object Shading
Flat Shading
Gouraud Shading
Phong Shading
Gouraud
(R2,G2,B2)
(R1,G1,B1)
(R3,G3,B3)
Colour is linear function of (Ri,Gi,Bi)
Object Shading
Flat Shading
Gouraud Shading
Phong Shading
Phong
(R3,G3,B3)
Normal N is linear function of Ni, colour is computed using N for
illumination model
image
U
1
Theory:
(u,v) - (r*cos(2*pi*u), r*sin(2*pi*u),h*v
V
image
U
1
Theory
(u,v) - (r*cos(2*pi*u)*cos(pi*v), r*sin(2*pi*u)*cos(pi*v),
r*sin(pi*v))
V
1
image
3D Texturing
3 Dimensional Texturing
2 Dimensional textures only cover the surface of an object
3 Dimensional textures are defined for all points in space
Objects are cut from the texture space - much like sculpting
a statue from marble
Alternative rendering
techniques
Raytracing
Aims to improve realism of image
Slower than polygon rendering
Suitable for producing still images and animations
Radiosity
Further improvement of the shading model
Attempts to improve the treatment of ambient
light
Slow, but can be pre-computed and used with
polygon rendering or raytracing
scene
paper
grid
Ray Tracing
1
N
3
4
N
Trace a ray from the eye through a pixel, into the scene
Find the nearest object intersected by the ray
Cast a new reflected and refracted ray
Calculate light arriving from reflected, refracted rays and direct
illumination from lights in the scene
Apply shading model to get the colour of the object at the
intersection
Paint the pixel with the computed colour
eye
Radiosity
Build the
Environment
Determine the
form factors
Render the
Environment
Radiosity
Radiosity is not a rendering
technique