Week 12 Tutorial Solutions
1. Explain the advantages and disadvantages of normal mapping (a.k.a. bump
mapping) over adding extra polygons to represent detail.
o
Advantages: Every polygon we add to the scene creates extra
computation at every step of the p
package ass1;
import java.util.List;
import java.util.ArrayList;
import com.jogamp.opengl.GL2;
/*
* A game object that has a polygonal shape.
*
* This class extend GameObject to draw polygonal shapes.
*
* TODO: The methods you need to complete are at the
package ass1;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.glu.GLU;
/*
* The camera is a GameObject that can be moved, rotated and scaled like any
other.
*
* TODO: You need to implment the setView() method.
*
The methods you need to complete are
package ass1;
/*
* A collection of useful math methods
*
* TODO: The methods you need to complete are at the bottom of the class
*
* @author malcolmr
*/
public class MathUtil cfw_
/*
* Normalise an angle to the range [-180, 180)
*
* @param angle
* @return
package ass1;
import java.util.ArrayList;
import java.util.List;
import com.jogamp.opengl.GL2;
/*
* A GameObject is an object that can move around in the game world.
*
* GameObjects form a scene tree. The root of the tree is the special ROOT
object.
*
* E
Exam!
Exam
2 hours
14 questions
60% of your final mark
Open book
Calculators allowed
Bring a ruler and pencils/eraser
Part A Algorithms +
code
Demonstrate use of an algorithm. Similar to
many tutorial questions.
"In the scene shown, the camera is at (2,3,
COMP3421
Global Lighting Part1: Ray tracing
Global Lighting
The lighting equation we looked at earlier only
handled direct lighting from sources:
We added an ambient fudge term to account
for all other light in the scene.
Without this term, surfaces not f
COMP3421
The programmable pipeline and Shaders
The graphics pipeline
Model
Model-View Transform
Model
Transform
View
Transform
Illumination
Projection
transformation
Rasterisation
Viewport
Perspective
division
Clipping
Texturing
Hidden
surface
removal
Fra
COMP3421
Week 2 - Transformations in 2D and Vector
Geometry Revision
Exercise
1. Write code to draw (an approximation)
of the surface of a circle at centre 0,0
with radius 1 using triangle fans.
2. At home, modify the code to draw (an
approximation) of th
COMP3421
Introduction to 3D Graphics
3D coordinates
Moving to 3D is simply a matter of adding
an extra dimension to our points and
vectors:
3D coordinates
3D coordinate systems can be left or right
handed. y
y
Left
z
x
Right
z
x
We typically use right-han
COMP3421
Vector geometry, Clipping
Transformations
Object in model co-ordinates
Transform into world co-ordinates
Represent points in object as 1D
Matrices
Multiply by matrices to transform them
Matrices
2D array of numbers
1 0 3
2 3 4
0 0 1
Vec
COMP3421
Particle Systems, Rasterisation
Particle systems
Some visual phenomena are best modelled as
collections of small particles.
Examples: rain, snow, fire, smoke, dust
Particle systems
Particles are usually represented as small
textured quads or poin
COMP3421
Modeling, Bezier Curves, L-Systems,VBOs
Curves
We want a general purpose solution for
drawing curved lines and surfaces. It should:
Be easy and intuitive to draw curves
General, supporting a wide variety of
shapes.
Be computationally cheap.
Cu
package ass1;
import java.util.ArrayList;
import java.util.List;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLEventListener;
/*
* The GameEngine is the GLEventListener for our game.
*
* Every object in
COMP3421
Global Lighting Part 2: Radiosity
Recap: Global Lighting
The lighting equation we looked at earlier only
handled direct lighting from sources:
We added an ambient fudge term to account
for all other light in the scene.
Without this term, surfaces
Week 10 Tutorial Solutions
Question 1:
Use de Casteljau's algorithm to generate the point a t = 0.25 on the degree 3
Bezier curve with control points (0,0), (4,16), (20,8), (20,0).
The point is (4.8125, 7.875) as illutrated by the construction
below.
Ques
Week 9 Tutorial Solutions
Question 1
Consider the scan line algorithm described in class. For the polygon drawn here,
what does the edge list look like? What does the Active Edge List (AEL) look like just
before filling the pixels on scan line 5? What pix
Part A
Question 1
We need to use the equation
Id = Kd * Ld * s.m
Where Kd are the diffuse co-efficents of the material (0.4,1,0) and Ld are the diffuse co-efficients of
the light source (0.9,0,0.2).
S is the normalized vector TO the light source so is
s =
Week 11 Tutorial Solutions
Question 1:
The image below shows an eye ray from the camera hitting a glass sphere.
Draw the reflected and transmitted rays. Use Snell's law to compute refraction
angles, assuming the speed of light in the sphere is 50% of the
Week 6 Tutorial Solutions
Question 1:
i) The base is pointing inwards.
ii) The first side is pointing outwards
iii) The second side is pointing inwards.
iv) The third side is pointing outwards.
v) The fourth side is pointing outwards.
The image below show
Week 7 Tutorial Solutions
Question 1:
Consider lighting a quad on the surface of a cylindrical mesh with radius 1. You are
approximating the cylinder with a six-sided prism, as shown below. The position and
distance to the light source and camera are labe
Week 8 Tutorial Solutions
Question 1: 3D Surface of Revolution
Suppose we have a profile of a curve that is a quarter of a circle as defined by the
following function
C(t) = (radius*cos(t),radius*sin(t) For t [0.90]
What would the surface of revolution ar
Week 4 Tutorial Solutions
Consider the following OpenGL code:
gl.glMatrixMode(GL2.GL_MODELVIEW);
/ #1
/ Matrix is unknown - whatever value the last piece of
OpenGL code set it to.
gl.glLoadIdentity();
/ #2
/ Matrix is the identity:
/ [ 1 0 0 ]
/ [ 0 1 0 ]
Week 3 Tutorial Solutions
Question 1:
Go around the class and talk about why you're interested in graphics. What's the
coolest graphics application you have seen? What would you like to be able to
make?
Question 2:
Suppose we perform the following sequenc
COMP3421
Global Lighting Part 2: Radiosity
Recap: Global Lighting
The lighting equation we looked at earlier only
handled direct lighting from sources:
We added an ambient fudge term to account
for all other light in the scene.
Without this term, surfaces