程序代写代做代考 flex data structure arm COM6503: 3D Computer Graphics: Assignment 1 (27%)

COM6503: 3D Computer Graphics: Assignment 1 (27%)
Dr. Steve Maddock
Deadline: 3pm, Wednesday 7 December 1. Introduction
The aim of the assignment is to test your ability to construct and control a scene graph (hierarchical relationship of pieces) and to implement this using OpenGL commands. A model will be built from simpler geometric objects combined using transformations and then controlled to produce animation
Start by designing your program. This should only take a few hours since you may re-use any program code from the exercise sheets used in lab classes and you will already have worked through most of this code in order to understand it. Then implement the program. Don’t try to implement the entire program in one sitting. Do it in stages. And keep the interface simple.
2. Thetask
In lectures we looked at an example of a hierarchical object at The Guerrilla CG Project (see Figure 1 and http://www.youtube.com/user/GuerrillaCG/videos – https://www.youtube.com/watch?v=q54fbMvl3GE). In this assignment you will build and animate something similar.
You must satisfy all the following requirements:




Figure 2: Alternative designs for a robot
made from a single sphere with either a single sphere or two spheres as an eye or eyes, respectively, protruding slightly at the front of the head. The hands could also be simpler than those shown in Figure 1. Figure 2 gives some examples. You can use the standard OpenGL GLUT objects to model the robot parts (see later note on texture mapping). 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. (Hint: You need to be thinking about object-oriented programming when you develop your model, so that multiple robots could be easily produced.)
Model the eyes (or single eye) as spheres with spotlights shining out of them in the direction of travel. There must be an option in the interface to turn the spotlight(s) on and off. (Hint: A spotlight should look like a spotlight, as well as behave like a spotlight. So, consider emission properties for the object that is modelling the part where the spotlight is shining from.)
You may choose whatever colours you wish for parts of the flying robot. (Note: the standard glut objects do not include texture coordinates, so they cannot be texture mapped. For this project it will suffice to use the standard ambient, diffuse, specular, and emission properties to change the colour of parts of the flying robot. If you wish to use texture mapping for the robot, consider using GLU quadric objects, which have texture coordinates.)
The robot should be placed inside a large room. Figure 3 illustrates this and shows the robot with one eye which has a spotlight shining from it in the
Figure 1: Building a hierarchical robot (The Guerrilla CG Project: http://www.youtube.com/user/GuerrillaCG/videos – https://www.youtube.com/watch?v=q54fbMvl3GE)
 You must design and build a flying robot made out of at least 8 pieces arranged in 4 hierarchical layers, e.g. head (including eye (s)), upper arms, lower arms, hands. The head of the robot should also have an extra attachment, e.g. glasses, ears, hair or a hat. Each of the pieces can be made out of simple geometric objects, such as spheres, cylinders and cuboids, similar to the example in Figure 1 – it must not be the same as Figure 1. For example, the elaborate robot head in Figure 1 can instead be
1

This shows the effect of an eye which is a spotlight shining on the floor – the grey dotted lines are drawn to illustrate the spotlight effect and would not, of course, appear in practice.
Texture map of wooden floor or some fantasy cartoon-like scene on the ground plane
direction of travel. (Note: the relative size of the robot with respect to the room is not necessarily to scale.)
 The floor, the four walls and the ceiling of the room must be texture-mapped with appropriate textures, e.g. the floor could be texture-mapped with a wood pattern and the walls might be texture-mapped to look like the walls of a small art gallery or a person’s living room. (Hint: A set of triangles organised to make a plane – see exercise sheets – could be used to model the floor, walls and ceiling, with appropriate transformations, and a separate room class could be created for collecting together the pieces of a room.) There should be a window in one of the walls (which could just be a texture map) that shows the scene outside the room (e.g. a picture stored in a texture map). Consider the textures you use carefully. You need to use the right OpenGL settings to make sure they display well. For extra marks, consider switching between different window textures at certain points in time to model a change outside the room, e.g. daytime versus night- time.
 The room should be illuminated with some general world lights which can be positioned at any point in the world (e.g. outside the room), which it should be possible to turn 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 they are turned off (or dimmed) the effect of the robot’s spotlight(s) will be much more dramatic, like someone shining a torch in a darkened room.
 The ceiling of the room should have two spotlights pointing down from it. These will create pools of light in specific areas of the room. Again, when the general world lights are turned off, this would create a dramatic effect. Consider how these lights should appear as models attached to the ceiling
 There should be three obstacles in the room that the robot must avoid whilst flying around – these can be modelled using simple geometric objects (GLUT objects or GLU quadric objects). Each obstacle must be attached to a different surface of the room, e.g. floor and two different walls, or floor, wall and ceiling. One of the obstacles must be an animating obstacle, e.g. a rotating cube in the middle of a stack
Texture map of wallpaper or some fantasy cartoon-like scene on each wall. One wall must feature a changing window scene
Figure 3: The room containing the flying robot
2

of cubes on the floor. One of the obstacles must feature a small gap for the robot to fly through, e.g. a ring made from a torus, or a gap between two long items. This will cause the robot to have to tuck in its arms to avoid a collision.
 The robot should fly around the room avoiding the obstacles but flying near, under, over or through them. A sequence of points representing the movement around the room (i.e. a path) could be stored in a simple array data structure, or in a file and read into the array data structure. The points and the robots orientation (and the orientation of its parts) can be carefully chosen such that the robot does not collide with the obstacles – do not attempt to try and deal with collision detection as part of the project. The robot can then move in straight lines or curves between the points. This requires you to design the program code necessary to control this. (The later exercise sheet on Animation Control will help here.)
 The animation should look plausible. Thus, whilst the robot is moving it should be pitching, yawing and rolling to compensate for movement and turning, and also animating its arms accordingly to give some ‘flourish’ to its behaviour as it changes direction or nears obstacles. This requires you to design the program code necessary to control this. Don’t worry about detecting self-collisions, e.g. the arm penetrating the body – for the purposes of this assignment, self-collisions do not matter.
 It is perfectly acceptable to interpolate the Euler angles to achieve movement of the hierarchy. Do not consider quaternions, as this is beyond the scope of this project.
 Use simple interface controls for the animation, e.g. buttons to stop, start and reset the animation. A reset button should reposition the robot at the start of the animation sequence.
 The camera should be positioned so as to point towards the centre of the room (which may be the world origin). The user should be able to use the mouse to rotate the camera around the scene. It doesn’t matter if the camera remains within the room or not, as long as the scene is visible.
 You do NOT have to do shadows. Do not worry about shadow effects.
Advanced work
 Add a second robot which chases the first robot. The second robot should have a different attachment to the head (e.g. glasses, ears, hair or a hat) and should move a little differently to the first robot.
3. 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 MOLE – 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 line on a standard Windows PC (such as the ones in the Lewin Lab in Regent Court or the managed desktop in the Diamond). 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 the command line.
 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 */
 If your program is based on code that I gave you, you must state that as part of these comments, and identify which bits you added.
 The body of the MOLE submission message should state that the work you have handed in is your own. It should also state which of the advanced options outlined in the deliverables above that you have undertaken.
 You must include a readme.txt file as part of your submission which describes how to run the program, i.e. what is the name of the main class? (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 .bat file to automatically compile and/or run the program.
 Optional: You might like to make a short video of your animation. (using some screen recording or screencasting software: https://en.wikipedia.org/wi ki /Comparison_of_screencasting_software). If you do so, DO NOT include this in the handin as it will be too big for MOLE to handle – we tried using MOLE 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 your
3

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.
4. Marking
plausible? Is orientation during turns accounted for? Do the robot’s arms move accordingly? The quality of the animation will be considered.
 (10 marks) The advanced work: this will be mainly about whether or not you have achieved the advanced work. Nonetheless, the quality of the advanced work will be considered too, e.g. the movement should not be exactly the same.
5. Some tips on developing your solution
in stages
It is possible for you to start work on the assignment immediately. For example, you could draw the scene graphs for the robot and for the full scene. You could build a robot model using the GLUT objects and check that you can control parts of the hierarchy.
After the exercise sheet on lighting, you could add a spotlight into the scene. When relevant material on creating meshes for different objects (e.g. a plane represented as a mesh) has been presented, you can build the room (and decide whether or not to replace the GLUT pieces with other pieces for parts of the robot). After the exercise sheet on texture mapping, you could add texture mapping to your solution.
Animation could be as simple as moving forwards and backwards along a straight line to begin with. This could be improved later after the exercise sheet on animation control.
This is only one possible development scenario. You must find the right process for you.
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, e.g. you might produce a model but not be able to animate it. Your program code will be run and exercised thoroughly.
Marks will be available for:
 The quality of the programming (20%)
 Satisfying the requirements (80%)
In assessing the quality of your program code, four
aspects will be considered:
 (5 marks) General style: layout; neat, organised code; comments; use of constants and variables; methods not over long;
 (5 marks) Program and data structures: use of separate methods and classes, e.g. a separate class for the room;
 (5 marks) Use of OpenGL transformations: appropriate use of push and pop and parent-child hierarchies;
 (5 marks) Animation control: how flexible is the solution?
In considering the requirements, five aspects will be considered:
 (27 marks) Modelling the robot and all parts of the room: the robot must be a hierarchical model. (Hint: consider drawing a scene graph for the robot model and another for the full scene before starting to program, as this will help you to structure your use of glPushMatrix and glPopMatrix.) Consider the use of high-resolution models so as to give better spotlight effects and the effect of this on rendering speed (Hint: consider display lists). The quality of the relevant models will be considered. This part also includes the animation of one of the obstacles.
 (11 marks) Texturing: has the room been textured? The quality of the texturing will be considered, e.g. seams between textures and any extra texturing effects such as the changing window texture.
 (16 marks) Lighting and interface controls: spotlights should behave correctly such that their effect is seen on the scene. Also, make sure you include general lights and the necessary interface controls, as described in the above specification.
 (16 marks) Robot animation: the focus is mainly on the robot. Is the animation smooth? Does it look
4