1. Introduction
COM3503 3D Computer Graphics: Assignment (50%)
Dr Steve Maddock
Deadline: 3pm, Tuesday 8 December
The assignment will involve using modern OpenGL to render a scene. Scene graphs are required in the modelling process and animation controls are required for hierarchical models.
2. Thetask
Figure 1 shows a room scene containing a table and a window looking out onto a view. There is a noticeboard on one wall. On the table is an unusual angle-poise lamp, a mini helicopter-like object, a piece of paper and a drawing pen. The whole scene can be modelled using planes, cubes and spheres.
Figure 1. The scene
1
3. Requirements
You must satisfy all the following requirements:
• Only two walls and a floor for the room should be modelled. The walls and floor should be texture mapped to look like a room in a house. For example, the floor could be made of wood. The walls may have wallpaper on them or a paint pattern.
• The table can be modelled as one scaled flat cube on top of four legs made out of cubes. The table should be texture-mapped, for example, to look like wood or some other material.
• The hierarchical model of the basic angle-poise lamp (see Figure 2) should be made up of five parts: a base, a lower arm, an upper arm, and a head, which contains a protruding lightbulb (a nose) in the shape of a cube (the details of the lighting technology used are not important). There are also some additional pieces.
o The base is fixed at one position on the table. Three other parts can articulate as illustrated in Figures 1 and 2. The lower arm can rotate about the connection point with the base in two directions (around the vertical y axis and around the x axis), the upper arm can rotate about the lower arm (like an elbow joint, the x axis) and the head can rotate about the upper arm (in one axis, the x axis). (The x axis could be substituted by the z axis if you prefer.) The lightbulb shines in the same direction that the head is pointing in, as indicated by the dotted lines in Figures 1 and 2.
o A company is using this lamp in an advertising campaign in which they hope to sell more interesting angle-poise lamps. Thus, you need to add some decorative pieces that make the lamp look unusual or like an animal (see Figure 2). Do not just copy the decorative pieces used in Figure 2; invent your own pieces. For example, you might add a hat or make the ears more interesting, or add some hair, or horns, or a larger nose, or a different tail or a different base.
o Use simple objects for the individual parts, i.e. scaled spheres or cubes. For example, in Figure 2, the head is made from a combination of a cube for the lamp head and a cube for the bulb, with some other cubes and spheres for the decorations. Cubes and spheres are the only pieces needed to model the lamp. The hierarchy and associated transformations are more important than the quality of the pieces in the hierarchy. I want you to demonstrate that you understand transformations and a scene graph hierarchy.
o The pieces of the lamp must be texture-mapped. For example, you might decide to make the pieces spotty to look like a particular animal.
o The head of the lamp must include an object (e.g. a nose bulb), modelled as a cube or sphere, which mimics the effects of a spotlight. The object gives the position of the spotlight and the orientation of the head gives the direction the spotlight is pointing in. The spotlight will thus illuminate the scene in the direction the lamp head is pointing in. There must be an option in the interface to turn the spotlight (and associated object) on and off. (You are responsible for working out how to implement a spotlight effect – read the relevant section in Joey’s online tutorial.)
• The mini helicopter-like object can be made of a combination of spheres and/or cubes. The propellors must spin as the cube lifts off the desk, rises up and then descends back down to the tabletop. It should do this under menu control, e.g. a button to start and a button to stop. The body of the mini helicopter-like object should have separate matt and shiny parts. (Hint: diffuse and specular maps.)
• There should be a piece of paper and a pen (a scaled sphere will suffice) on the tabletop and a notice board on the wall above the desk. Exact sizes are not important.
• An outside scene can be seen through the window – this might be a garden scene or a city scene. You could use a picture out of a window in your own accommodation or you could invent a picture. Consider how you might do the scene outside. Should it be a texture map pasted onto the wall to look like a window and a scene? Or should it be a texture map pasted onto another surface that is a certain distance outside the window? Figure 1 illustrates both (with the outside scene a bit too close to the wall due to the limitations of space for the illustration). How does each look when the camera moves position? Also, should the scene outside the window be the same at different
2
Figure 2. A model of an angle-poise lamp that looks like a strange alien animal
times in the day? Should the scene change for night and day? Another option might be a skybox outside the window. Note: If there is a hole in the wall, this will mean making the wall from a set of pieces with a hole where the window is. The quality of what you produce for this part of the scene will be part of the marking.
• The scene should be illuminated with at least two general world lights which can be positioned anywhere in the world (perhaps with one in the general direction of the sun). It should be possible to turn each of the lights on and off (or dim, i.e. reduce the intensity) from the interface. These general world lights will illuminate all parts of the scene and help visualise the scene during development and testing. When you switch off the general light(s), the effects of the lamp spotlight will be much clearer on the table and the rest of the room.
• A user-controlled camera should be positioned in the scene. Use the camera that was given in one of the exercise sheets – the mouse can be used to change the direction the camera is pointing in and the keys can be used to move about. Do not change the key mappings from the one on the exercise sheet. If you change the key mappings it will make it difficult for me to mark. It doesn’t matter that the camera can see outside the room.
• The interface should have a button (labelled ‘Random Pose’) to make the lamp parts adopt random angles to each other to make a pose. The angles between the parts of the lamp should be within certain ranges so that the result is plausible, i.e. just as you elbow cannot bend ‘backwards’, the lower and upper arm of the lamp should not be able to bend backwards with respect to each other. Also, the main lamp parts shouldn’t intersect each other or the table – don’t worry about the decorative parts of the lamp. Some of the decorative pieces might move in response to the pose adopted by the lamp. The lamp should animate between the poses rather than immediately assume the new pose. A reset button can be used to reposition the lamp to some neutral pose. Also, you should consider the speed of the animation. It is perfectly acceptable to animate the Euler angles to achieve movement of the hierarchy. Do not consider using quaternions, as this is beyond the requirements for this assignment.
• You do NOT have to do shadows. Do not worry about shadow effects.
4. Deliverables
• You should submit a zip file containing a copy of your program code (and any other necessary resources, e.g. image files for the textures and a readme.txt file that describes everything) via Blackboard – this can be done
via the link to the assignment handout. You should submit whatever you have done, even if you have not completed all the requirements – for example, you might have produced a model but not done the animation. If you submit nothing, you cannot receive any marks. The program MUST compile and run from the command window on a Windows PC or the terminal window on a Mac. You should assume that the jogl environment (and paths) has already been set up, so you do not have to include this as part of what you hand in. I won’t install ‘YetAnotherIDE’ to make your program work; I want to run the program (and, if necessary, check the compilation) from a command or terminal window.
• You must include appropriate comments in your program to identify that you wrote the code, e.g. /* I declare that this code is my own work */ /* Author
• You can make use of all the code that I have given you on exercise sheets. However, state that you have used it as part of your comments and briefly summarise which bits you used.
• The body of the Blackboard submission message should state that the work you have handed in is your own.
• The name of the main class in your program should be Anilamp. That way it is easy for me to run the program. (Last year, I wasted time for some handins trying to work out which was the main class to run.) It would be useful to include a batch/script file to automatically compile and/or run the program.
• Optional: You might like to make a short video of your animation. If you do so, DO NOT include this in the handin as it will be too big for Blackboard to handle – we tried using Blackboard for this in the past and it crashed the system!! Instead, put the animation on youtube or your personal website and give the URL of the animation in a readme.txt file. Indeed, if you are thinking of a career in the graphics industry, then you should be adding such animation pieces to your personal website (your digital portfolio) to show off what you are capable of.
5. Marking
I will check that the program meets the requirements listed above. To make sure you get some marks, the program must compile and do some part of the work requested even if it is not complete. Your program code will be run and exercised thoroughly.
Marks will be available for:
• The quality of the programming (20%)
• Satisfying the requirements (80%) 3
In assessing the quality of your program code, four aspects will be considered:
UG:
https://sites.google.com/sheffield.ac.uk/comughandboo k/general-information/assessment
PGT:
https://sites.google.com/sheffield.ac.uk/compgtstudent handbook/menu/assessment
• (5 marks) General style: layout; neat, organised code; comments; use of constants and variables; methods not over long;
• (5marks)Programanddatastructuresforthemodels: use of separate methods and classes, e.g. separate classes for things like the lamp; (The online tutorial does not make use of classes for the more complex examples, partly on purpose. You must consider the use of classes for the assignment – this demonstrates your programming ability and ability to work with scene graphs.)
• (5 marks) Neat and tidy coding for dealing with transformations in the scene; How will you organise the construction and use of the scene graphs?
• (5 marks) Animation/posing control: how tidy and flexible is the coding?
In considering the requirements, four aspects will be considered:
• (25 marks) Modelling the lamp and other parts of the scene: the lamp must be a hierarchical model. (Consider drawing scene graphs for the lamp model, the helicopter and the full scene before starting to program.)
• (20 marks) Texturing: lamp, room (walls and floor), poster board, table, objects on table and window. The quality of the texturing will be considered, e.g. use of diffuse and specular textures, seams between textures and any extra texturing effects such as the changing window view texture.
• (15 marks) Lighting and interface controls: lights should behave correctly such that their effect is seen on the scene. Necessary interface controls, as described in the above specification, should also be included.
• (20 marks) Lamp pose control and animation and mini helicopter animation. Is the animation smooth? Does it look plausible? The quality of the animation will be considered. Are the random poses for the lamp plausible?
6. Unfairmeans
• The Department’s student handbooks (UG and PGT) give detailed information on the topic of unfair means and what happens if unfair means is used.
7. Latehandin
• Standard Department rules will be applied if the work is handed in late: UG and PGT.
Links to handbooks
4