聯系方式

您當前位置:首頁 >> C/C++編程C/C++編程

日期:2019-06-04 11:39

EBU5405: 3D Graphics Programming Tools - Coursework 2019

In this coursework you will develop an articulated and interactive object in the shape of a

crawling animal using C and OpenGL. The main objectives of this project are to practice and

demonstrate: hierarchical modelling, model rendering, viewing transformations, lighting,

interactivity and animation using OpenGL and the GLUT.

Examples of crawling animals: turtle, lizard, ant, spider, snake, etc.

The coursework is divided into two parts. During the first part of the coursework (Labs 4 and

5), you will develop the 3D hierarchical model of your articulated object and implement some

rendering and interactivity. In the second part of the coursework (Labs 6, 7 and 8), you will

add lighting to your object and create an animation.

The outcome of each lab should be saved in a folder with the name of the lab (i.e. Lab4, Lab5,

etc.). In each folder, you should include the source code and the compiled application. Please

add comments to your code!

The outcome of the coursework (i.e. all the saved five lab folders, from Lab 4 to 8) should be

placed in a folder named xxxxxxxEBU5405 (replace xxxxxxxx by your BUPT student number).

This folder will be submitted via QMplus after lab 8 (i.e. there is only one submission). Details

of the deadline can be found on QMplus.

Practical details:

- Programming language: C and OpenGL (no other languages allowed)

- Individual coursework: your animated articulated object must be unique!

- Supported by lab sessions and TAs

- The submission is after Lab 8 (see details of the submission date on QMplus).

- The coursework is worth 25% of the final mark and will be marked out of 100.

- Late submission penalties: -1 mark per day late, up to -4 marks (4 days).

- Cut-off date is 4 days after submission date. After the cut-off date, any submission will

be caped to 50%.

- No extension will be granted unless valid extenuating circumstances (ECs) have been

submitted and accepted following the usual EC submission process.

Lab 4

1. Aim

The aim of Lab 4 is to build the articulated object.

The basic requirements for the articulated object are that it should:

- be made of at least 8 articulated parts;

- present some dependencies between the parts;

- evoke the shape of a crawling animal.

Warning! Your articulated object must be the result of your own design; it should be unique. Marks

will be allocated for originality.

2. Content of Lab4

2.1. Object parts

You should implement each part in a separate function.

If you decide that some of the parts should be cylindrical objects, you can use the GLU quadrics objects

(e.g. gluCylinder) to implement them.

The GLU quadrics objects are based on Quadrics, which are a way of drawing complex objects. To use

Quadrics, you must first declare a variable:

GLUquadricObj *p; // pointer to quadric object

Initialise it:

p = gluNewQuadric(); // initialisation

And then use it to create the GLU quadrics object, for example:

gluCylinder (p, 1.0, 1.0, 3.0, 32, 32); /* cylinder of radius 1.0 at its base; radius 1.0 at its top; height of

3.0; 32 slices (subdivisions around the z axis); 32 stacks (subdivisions along the z axis) */

For a reference to the GLU quadrics objects, please see here:

http://www.glprogramming.com/blue/ch06.html#id38149

2.2. Modelling transformations

Write a function called “animal”. In this function, you will write the modelling transformation

statements (e.g. glRotatef and glTranslatef) that will allow you to build the object using its individual

parts.

2.3. Display callback and isometric view

The “animal” function above will be called in the display callback. But before you call this function,

make a call to the gluLookAt function in order to create an isometric view of the object.

2.4. Reshape callback

Write a reshape callback in which you should call the glOrtho function. Choose carefully the arguments

of the glOrtho function so that the whole object appears in the middle of the window. Make sure the

object preserves its shape and proportions even in the event that the window’s aspect ratio changes.

3. Outcome of Lab4

The outcome of this lab should be a static 3D graphics, which shows an isometric view of the object.

Save your work in a folder named Lab4, include all your code and .exe application. Do not forget to

comment your code.

Lab 5

1. Aim

The aim of Lab 5 is to interact with the object. For this, you will need to revise the outcome of lab4 to

ensure that the object is modelled as a hierarchical object.

2. Content of Lab5

2.1. Hierarchical modelling

Think carefully about the dependencies between the individual parts of the object. Refer to the slides of

the HierarchicalModelling lecture and revise the object function you developed in Lab4 accordingly.

Remember that to model the object as a hierarchical object, you must use the matrix stack.

Hint: In the individual modelling functions, it may be a good idea to ensure that the end points of any

future rotation (see details of the interaction below) stand at the origin of the coordinate system.

2.2. Menu based interaction

You will write a menu which will allow you to test the hierarchical modelling of your object. The menu

will be used to animate the object.

The menu should be attached to the right button of the mouse and show the following three options:

ZigZagMotion, Crawling and Rotation.

2.3. ZigZagMotion

When the ZigZagMotion option of the menu is chosen, the object should be animated to change its

position (not its shape) inside the window. The object should follow a zigzag trajectory inside the

window. The animation should only stop when the ZigZagMotion option is selected again in the menu.

Make sure that the object always remains visible, i.e. it should not exit the window.

Example of zigzag trajectory:

2.4. Crawling

When the Crawling option of the menu is chosen, the articulated object should be animated so the

various parts are moving around their joints. The position of the object inside the window does not

change (unless the ZigZagMotion option is still selected). The animation should only stop when the

Crawling option is selected again in the menu.

2.5. Rotation

When the Rotation option of the menu is chosen, the object should rotate on itself along the Y axis. The

animation should only stop when the Rotation option is selected again in the menu.

3. Outcome of Lab5

The outcome of this lab should be an interactive animated 3D graphics which allows us to change the

position, shape and orientation of the object.

Save your work in a folder named Lab5, include all your code and .exe application. Do not forget to

comment your code.

Lab 6

1. Aim

The aim of Lab 6 is to understand and practice lighting using OpenGL and to start adding lighting to the

articulated object.

2. Lighting exercises

You should download and open the Week3Code.doc file.

Copy and paste the two code samples in their own .c files and name each .c file as shown in the

Week3Code.doc file. Compile and run each program.

Now try answering the questions or exercises below.

a) spheres.c

i. Using the Colour Converter Flash application (which can be found on QMplus),

observe all the colours declared in the various light and material properties.

ii. Given the light and material properties you observed above, can you explain the aspect

of each of the spheres?

iii. Modify the colour declarations as you like, observe and try to explain the changes you

can see on the spheres.

iv. Modify the position of the light and try to explain what you observe as a result.

b) cube.c

i. Repeat questions i, ii and iii above for the cube.

ii. Re-calculate all the normal vectors and verify that they are correct.

iii. Modify the code so the light source is fixed relative to the cube, i.e. you want the light

to rotate with the cube. A single face (always the same) should appear illuminated.

iv. Modify the code so the cube is fixed (rotated only once by 45 degrees on each axis), but

the light source continuously rotates around the fixed cube. For a better result, you may

want to use a greater increment for the angles theta[axis].

3. Lighting the object

3.1. Light source

Set up a fixed light source similar to the one used in the cube.c program. Insure that your code is

complete (e.g. declaration of normals (if needed), lighting and light source enabled, etc.).

3.2. Materials

Declare different types of material for the different parts of the object. The object should display

various colours, some parts should be shiny, and others shouldn’t.

4. Animation of the object

You should remove the interactive menus you implemented in Lab5 and add the following interaction: a

click anywhere inside the window with the left button of the mouse should start and stop the animation

of the object. How the object behaves is up to you. You should try to implement a behaviour that

evokes the typical behaviour of the animal you have chosen. During the animation, the object’s position

should change while remaining inside the window at all time.

5. Outcome of Lab 6

The outcome of this lab should be an animated object that is shaded using OpenGL lighting

calculations.

Save your work in a folder named Lab6, include all your code and .exe application. You must comment

your code.

Lab 7

1. Aim

The aim of Lab 7 is to experiment with various types of materials.

2. Content of Lab 7

2.1. Materials

Test different types of materials for the different parts of your object. Retain three sets of materials that

you like and that make your object look like your chosen animal. You are not using texture (as we

haven’t learnt how to use texture) so we are not looking for perfect realism but try to use your

imagination and trial and errors to achieve the most realistic effects that you can. Find an appropriate

name for each of the three material sets. Remember that this is an individual coursework and that your

object must be unique. Marks will be given for originality and realism.

2.2. Interaction

Implement a menu attached to the right button of the mouse that can be used to select the type of

material used to render the object. Use the names you chose in the question above to display the options

in your menu.

3. Outcome of Lab 7

The outcome of this lab should be an animated 3D articulated object, which can be shaded using

different materials. The light source is the one you set up in Lab6. The object animation is controlled

using the left mouse button (unchanged since Lab6).

Save your work in a folder named Lab7, include all your code and .exe application. You must comment

your code.

Lab 8

1. Aim

The aim of Lab 8 is to experiment with the light source.

2. Content of Lab 8

2.1. Light source

Transform the light source you set up in Lab6 into a fixed spotlight. When choosing the position and

angle of illumination of the spotlight, make sure that during the animation, your animal receives more

or less light depending on its location. At times, your animal should receive no light at all. You want to

simulate a situation where your animal is hiding in a dark corner …

2.2. Object animation

The object is animated exactly as in Lab 7.

3. Outcome of Lab 8

The final outcome of the coursework (i.e. outcome of lab 8) should be an interactive animated 3D

articulated object, which can be shaded using three different sets of materials. The material set can be

chosen using a popup menu attached to the right button of the mouse. The light source simulates an

environment which is only partially illuminated. The object animation is controlled (start/stop) with a

mouse click using the left button of the mouse.

Save your finished object in a folder named Lab8, include all your code and .exe application. You must

comment your code.

Place the five folders: Lab4, Lab5, Lab6, Lab7 and Lab8 in a folder named xxxxxxxEBU5405

(replace xxxxxxx by your BUPT student number), and submit it as a zip archive on QMplus before

the submission deadline.

Marking criteria

Total mark calculated out of 100

Labs 4 & 5 (Part 1): marked out of 40

- The object is made of at least 8 articulated parts up to 5 marks

- The object evokes the shape of a crawling animal up to 5 marks

- Isometric view created with a call to the gluLookAt function up to 3 marks

- Reshape callback which calls the glOrtho function up to 3 marks

- Implementation of menu interaction up to 2 marks

- ZigZag

- implemented up to 3 marks

- complexity (e.g. number of turns) up to 3 marks

- Crawling

- realism up to 5 marks

- complexity (e.g. number of parts involved) up to 5 marks

- Rotating

- implemented up to 3 marks

- control of the axes of rotation up to 3 marks

Labs 6, 7 & 8 (Part 2): marked out of 60

- Animation of the object according to the Lab6 requirements:

- realism up to 6 marks

- complexity (e.g. number of parts involved) up to 6 marks

- control of the animation with the mouse up to 3 marks

- The three material sets according to the Lab7 requirements:

- materials one (realism and name) up to 5 marks

- materials two (realism and name) up to 5 marks

- materials three (realism and name) up to 5 marks

- Illumination according to the lab8 requirements:

- spotlight setup up to 5 marks

- “hiding corner” simulation up to 5 marks

- Global appreciation:

- originality of the design (ideas) up to 10 marks

- general appearance (shape + colours + behaviour) up to 10 marks


版權所有:編程輔導網 2018 All Rights Reserved 聯系方式:QQ:99515681 電子信箱:[email protected]
免責聲明:本站部分內容從網絡整理而來,只供參考!如有版權問題可聯系本站刪除。

25选5一等奖多少钱