Assignment title: Information
ASSIGNMENT 2
VIEWING, LIGHTING AND TEXTURING
G53GRA Computer Graphics 9th March 2017
This assignment is compulsory and worth 15% of your final mark for this module. It is
due for submission by 3pm Thursday 30th March 2017. Submission should be made
via Moodle. Late submissions will receive a penalty of 5% of the assignment grade per
working day.
Files must be submitted in .zip or .pdf format and contain both answers to the questions
and your code. Please provide screen shots embedded into your answers document or
as separate image files in your .zip file.
The assignment is based on lectures 5–8, and covers viewing, lighting and texturing.
All questions have equal weighting and are each worth 20% of the assignment.
1 Transformation in Camera Space
y
z
x
v
u n
eye (du,dv,dn)
Suppose in a graphics program, the camera/eye is positioned at p = (10, 10, 10)
in world space. The camera's coordinate
axes are defined as follows:
u = (1, −1, 1)
v = (1, 1, 0)
n = (0.5, −0.5, −1)
Where u is the right vector of the camera, v
the up vector, and n is the viewing direction.
Calculate the new position of the camera,
p0 after a transformation in camera space is applied, such that its position is translated
by du = 2 along u, dv = 1 along v and dn = −1 along n.
You must show your complete working.
Assignment 2: Viewing, Lighting and Texturing 12 Projection and Hidden Surface Removal
Describe the processes involved in projecting 3D graphics objects onto a 2D screen,
using both orthographic and perspective projection. Describe the process of face culling,
and explain how OpenGL determines which surfaces are hidden in a 3D scene.
3 Light Reflection Models
Describe the individual components of the Phong reflection model and how they are
combined to create a final lit scene. Describe how the light, viewing direction and
surface normal affect the light intensity at a point on the surface of an object.
Note: Do not confuse the Phong reflection model with Phong interpolation shading.
4 Programming Exercise: Wall Lights
light a light b
Use OpenGL commands and freeglut to
model two lights on a planar "wall". You
should render a wall that is perpendicular to the view direction (such that you
can see the wall straight on), and two
positional light sources in front of or on
the wall plane. The light sources should
use different diffuse lighting colour, and
have non-constant attenuation (reduction
intensity with distance from source).
The diagram is a basic demonstration of what your program should produce. Your
lighting scene need not strictly match the appearance of this diagram – it is largely for
reference.
Note: You may find the Floor class from the Viewing Example demo helpful.
Note: You do not need to visualise your light sources as objects for the assessment, but
you may find it useful as a location reference.
Assignment 2: Viewing, Lighting and Texturing 25 Programming Exercise: Texture Blending
Extend the Textured Sphere demo to combine the two bitmap images using OpenGL
blending, as shown in the diagram. You should use glBlendFunc(), and state which
blending function you have used and explain why.
The textures can be downloaded here.
The demo branch for the Textured Sphere is available here.
Note: You only need to submit your new BlendedSphere object code, rather than the
whole project.
Note: Do not combine the textures in photo editing software.
Assignment 2: Viewing, Lighting and Texturing 3