Course pages 2016–17

# Computer Graphics and Image Processing

## Supervision work

The course can be covered comfortably in four supervisions. The schedule below suggests three supervisions following the material as it is taught, followed by a final supervision to go through some Tripos questions, but remember that some past exam questions cover material that is no longer on the syllabus.

The questions were written by Dr Chris Faigle, Prof. James Gain, Dr Jonathon Pfautz, and Prof. Neil Dodgson. Each set of exercises contains up to three sections:

- Warmup questions -- These are short answer questions that should only take you a few minutes each.
- Longer questions -- These are geared more towards real exam questions. You should make sure that you can answer these.
- Advanced questions -- These go beyond the syllabus. They are harder problems that will be worth your while to answer if you find the other questions too easy.

Much of the course concerns design decisions for efficient implementation of graphics algorithms. It would be worth consolidating these through practical programming exercises. Some suggestions are given below, but there is obvious scope for much more extended projects.

Supervisors are advised that setting students all of these exercises is likely to require too much work, and that some exercises should be left for the vacations and revision.

## Practical exercises

Three practical exercises have been prepared to illustrate some of the ideas in this course.
They can be found on the IB Graphics Moodle site.
(The exercises are described as *Ticks* but are purely for instruction and are not part of any formal assessment.)

Template Java code is provided for each exercise, and it should be possible to complete each in a couple of hours. The results can be submitted for automatic assessment if desired.

## Preparation

Read Chapter 2 of Shirley & Marschner to revise some of the vector mathematics that will be used in the course.

## Introduction and simple rendering

### Warmup questions

- Suppose you are designing a user interface for someone who is colour blind. Describe how some user interface of your choice should be suitably modified.
- Why is it better to look at faint stars and comets slightly off-centre rather than looking directly at them?
- In a CAD system using blue lines on a black background would be a poor choice for the interface colours for designing an object. Why is this?
- In New Zealand, warning road signs are black on yellow, it being alleged that this is easier to see than black on white. Why might this be true?

### Longer questions

**Monitor Resolution**. Calculate the ultimate monitor resolution (i.e. colour pixels/inch) beyond which better resolution will be unnecessary.**Pixels**. Why do we use square pixels? Would hexagonal pixels be better? What about triangles? Do you see any difficulties building graphics hardware with these other two schemes?

### Advanced question

- Why is the sky blue?
[Hints: Why
*might*it be blue? Why are sunsets red? Are the red of a sunset and the blue of the sky related?]

## Graphics pipeline, algorithms for 2D and 3D

### Warmup questions

**Matrices**. Give as many reasons as possible why we use matrices to represent transformations. Explain why we use homogeneous co-ordinates.**Texture Mapping**. Are there any problems with texture mapping onto a sphere?**Phong**. Describe how Phong's specular reflection models real specular reflection. Why is it only a rough approximation? Why is it useful?**Coordinate Systems**. Draw pictures to show what is meant by:- object coordinates
- world coordinates
- viewing coordinates
- screen coordinates

**Triangle mesh approximations**. We use a lot of triangles to approximate stuff in computer graphics. Why are they good? Why are they bad? Can you think of any alternatives?

### Longer questions

**Bézier cubics.**Derive the conditions necessary for two Bézier curves to join with- just
*C0*-continuity; *C1*-continuity;*C2*-continuity.

*C2*-continuity at the two joins?- just
**Projection.**Draw and explain two different scenes which have the same projection as seen by the viewer. What other cues can you give so that the viewer can distinguish the depth information?**Bounding Volumes.**For a cylinder of radius 2, with endpoints (1,2,3) and (2,4,5), show how to calculate:- an axis-aligned bound box
- a bounding sphere

**BSP Tree.**Break down the following (2D!) lines into a BSP-tree, splitting them if necessary:- (0,0)-(2,2)
- (3,4)-(1, 3)
- (1,0)-(-3,1)
- (0,3)-(3,3)
- (2,0)-(2,1)

**Sphere Subdividing.**We often use triangles to represent a sphere. Describe two methods of generating triangles from a sphere.**Surface detail.**Compare and contrast:*texture mapping**bump mapping**displacement mapping*

**3D Clipping.**- Compare the two methods of doing 3D clipping in terms of efficiency.
- How would using bounding volumes improve the efficiency of these methods?

**Rotation.**- Show how to perform 2D rotation around an arbitrary point.
- Show how to perform 3D rotation around an arbitrary axis parallel to the
*x*-axis. - Show how to perform 3D rotation around an arbitrary axis.

**3D Polygon Scan Conversion.**Describe a complete algorithm to do 3D polygon scan conversion, including details of clipping, projection, and the underlying 2D polygon scan conversion algorithm.

### Advanced Questions

**Bézier Patches.**Describe how you would form a good approximation to a cylinder from Bézier patches. Draw the patches and their control points and give the co-ordinates of the control points.**Bézier Patches.**Given the following sixteen points, calculate the first eight of the next patch joining it as*t*increases so that the join has continuity*C1*. Here the points are listed with*s=0*,*t=0*on the bottom left, with*s*increasing upwards and*t*increasing to the right:(-.2, 3.4, .3) (1, 3.1, -.2) (2, 2.6, -.2) (3.1, 2.8, .2) (0, 1.2, .4) (1.2, 2.0, 1.2) (1.4, 1.9, -.2) (2.7, 1.8, .2) (.2, 1, -.2) (1.1, .8, .5) (1.4, 1.0, 0) (3.1, 1.1,-.2) (0, 0, 0) (1, 0, .5) (2, .2, .4) (2.7, 0,-.2) **Rotations.**Define and then compare and contrast the following methods of specifying rotation in 3D. (You will need to look these up.)- Quaternions
- Euler Angles

**Improved shading models.**Find out about the Cook-Torrance shading model and explain how this improves on the naive diffuse+specular+ambient model.

## Colour, displays and image processing

### Warmup questions

- Compare and contrast the use of LCDs and electrophoretic displays for screens in portable devices.
- Compare the rendering in some different pieces of printed material. Use a magnifying glass to explore the resolution, colours and patterns used.

### Longer questions

**Colour Spaces.**Explain the use of each of the following colour spaces:- RGB
- XYZ
- HLS
- Luv

**Additive**Explain the difference between additive colour (RGB) and subtractive colour (CMY). Where is each used and why is it used there?*vs*Subtractive.**Error Diffusion.**Compare the two methods of Error Diffusion described in the notes, with the aid of a sample image.

### Advanced questions

**Printing**. Select one of- laser printing
- ink jet printing
- offset printing.

**Displays**. Select one of- electrophoretic display
- DMD display
- LCD display.

### Practical programming

Implement some of the line and curve drawing and clipping algorithms in 2D.