Assignment 3
Assignment 3
Description
The third assignment will introduce camera paths, environment modelling, movie creation and the workflow required for producing graphics systems. The assignment is to use the class’s models to generate a large scale city environment and then create a movie showing your city. The final lecture of class will be a presentation of your movie (on Tuesday 8th April 2014 - attendance is mandatory; a zero grade is awarded to anyone who doesn’t show up).
The deadline for this assignment is 1pm on Monday 7th April 2014. There are no late submissions allowed. A zero grade is given for work not submitted on time.
Submission is done through the WebCT/Vista system and deadlines are firm - a grade of zero will be given to anyone who does not submit the assignment before the deadline.
Deadline: 1300 Monday 7th April 2014 (Mandatory presentations on Tuesday 8th April)
Create the city, direct the movie
The assignment is to construct a cityscape environment using the buildings defined by the class. You are *NOT* required to create an accurate model of the UBC campus or downtown, you can place your buildings anywhere in your scene.
1)Select the building models you wish to use (including your own) to make up your cityscape environment. A minimum of five is required to get marks for complexity and modelling. The five models you select must be unique! If you have the same building more than once in your city, that counts as one model. Selecting five different models and putting multiple versions into your scene is an effective way to create a cityscape. When unzipping the models, the directory name should be the same as the zip file - do not rename the directory or the model name, since your city file will be used with our local copy of the models (this way you don’t need to submit the models you use).
2)A very simple file format is described below to represent the city you define. You must not hardcode the model filenames or city filename into your code, since we will be testing using the .city files you define. The city filename should be supplied as an argument on the command line (-10% mark if you do not use this method). You should unzip all the models you are using into a single directory, with one directory for each. Each directory will be called BuildingName e.g. Kaiser - the same name as the zip file. Under this scheme a single .city file can be used to define what to render.
3)The camera fly-through should show every building in the model, and have at least one view from above. The camera path can be defined however you like: if you use a manually-operated camera you will not receive full marks (see the marking scheme below). Automatic cameras can be created using linear paths in the scene, or something more complicated.
4)The environment should have defined boundaries. For example you could put the campus inside a large box and add textures to the box of the view to Vancouver Island or the mountains. There should not be any blank space. There should also be a textured ground and sky - the complexity of these is left up to you. You can represent the boundaries as a model in a .model file, and use the same code to render it. You do not need to use the Vancouver backdrop for your model, you can use any location.
5)The lighting theme is “Moving Spotlights”. Marks are awarded for a minimum of 2 spotlights moving continuously throughout the movie, as well as the complexity of the lights. This includes: integration into the virtual world (e.g. lights appear as parts of objects), changing colour, complex path, a higher number. Note that this component requires sources of light, not objects which appear to be lights.
6)The general theme for the movie is “Animation”. Marks are awarded for animating the scene - this could be a vehicle, people, or other objects (such as the buildings themselves) moving during the movie. More complex animations are rewarded with higher marks, such as objects following pre-defined paths, object deformation or object interaction.
7)Your program should render your name at the bottom right of the frame. If you want to make this look better than the built-in GLUT text functions, create an image with your name in it and render that as a texture. Do not include your student number inside the movie.
8)The main submission is a movie of your cityscape rendering. To create the movie capture the current framebuffer contents using glReadPixels(), and write each frame in your sequence to disk as a series of PPMs. Note that you have to allocate the memory for the framebuffer yourself and pass a pointer to that memory into glReadPixels(). Also remember that the coordinate systems of OpenGL and images have the y-axis flipped, so you’ll need to vertically flip the images before writing them to disk (or flip them afterwards using XnView or similar). (Alternatively you can encode the movie from within your application, using a library such as ffmpeg. If you are not comfortable configuring and using an external library, follow the instructions to export to PPM and use one of the utilities provided.)
9)You will need to convert these PPMs into another format which is readable by the movie-creation utilities. If you’re using BMP2AVI on Windows then use XnView or IrfanView (both easily do conversion of multiple files in one operation) to convert from PPM to BMP. If you’re using Framed X or Time Lapse Assembler on Mac, use jpg2ppm to batch convert from PPM to JPG.
10)After conversion to another format you can load them into a movie creation utility. If the utility you’re using does not export to the required format, you can convert using Quicktime, VLC, Handbrake or another application. You are NOT allowed to use programs which record the contents of windows within the OS (i.e. screen capture), you must grab the frames yourself from the framebuffer using glReadPixels(). If you use screen capture a mark of zero will be awarded for the entire assignment.
11)Your movie file should be called “FirstNameLastName.mp4”, e.g. “GregorMiller.mp4”. The movie should be a minimum of 10 seconds long; minimum 30 frames per second; dimensions of 1280x720; mp4 format with h.264 or x.264 encoding. (A mark of zero will be awarded for submissions not following these instructions exactly). The movie may be rendered in RGB or greyscale. Movies longer than 10s may have edits and other elements, however there must be at least one 10 second continuous uninterrupted sequence within the movie.
City File Format and Use
The following is the file format to use for your city; the file should be called CityName.city:
# Give your cityscape a name
UBiCuity
# Number of models specified
2
# List of models and transformations for each:
# First entry is the name of the model (including the path, using the directory
# this file is in as the reference)
# The next set of entries represent the transformation:
# Scale in x,y,z, Rotation around x-axis, y-axis, z-axis, Translation from origin i.e.:
PathTo1/Building1.model Sx1 Sy1 Sz1 Rx1 Ry1 Rz1 Tx1 Ty1 Tz1
PathTo2/Building2.model Sx2 Sy2 Sz2 Rx2 Ry2 Rz2 Tx2 Ty2 Tz2
...
Comments must start at the beginning of a line. There must be no whitespace at the beginning of any lines (blank lines, i.e. ‘\n’ are ok). The .city file should be placed in the same directory as the model directories, so the Path should be relative. Do NOT use absolute paths such as “C:\”, since *nix based systems (such as Mac OS X) do not support that. The same goes for *nix paths, Windows doesn’t have “/Users/” etc.
Sxyz are the scaling factors; Rxyz are the angles to rotate around the corresponding axis (Rx is the angle to rotate around the x-axis); Txyz is the translation from that model’s space to world space; You should push and pop the matrix stack for each building you put in the scene. The order of transformations should be rotx(Rx), roty(Ry), rotz(Rz), scale(Sxyz), translate(Txyz). In OpenGL this is:
glTranslatef(Tx, Ty, Tz);
glScalef(Sx, Sy, Sz);
glRotatef(Rz, 0, 0, 1);
glRotatef(Ry, 0, 1, 0);
glRotatef(Rx, 1, 0, 0);
Marking Scheme
The marking scheme is:
30% - Number of unique buildings: 3% per building included above minimum of five; all buildings must be textured and shaded. (Full 30% awarded for 15 buildings or more)
10% - Moving spotlights (minimum is 2 spotlights moving continuously throughout the movie)
15% - Complexity of lighting (number of lights, path of lights, changing colour, connection to virtual world objects, ...)
10% - Smooth camera (no jerkiness)
10% - Automatic camera (using pre-defined camera path)
5% - Textured environment
10% - Basic animation (objects moving for at least 10s of the movie)
10% - Complexity of animation (objects following pre-defined paths, object deformation, object interaction)
Penalties:
-10% : .city file not accepted on command line
-10% : Your building is not visible in the movie
-10% : Camera fly-through does not include a shot from above
-10% : Movie not named {Firstname}{Lastname}.mp4 e.g. GregorMiller.mp4
Zero grade : Less than five unique buildings
Zero grade : Something other than glReadPixels used to capture frames for movie
Zero grade : Movie not 1280x720, min 10s long, min 30 frames per second, h.264 (or x.264).
Extra credit: emissive regions of buildings to represent lighting (+1%); shadows (+5%); specular material for specular buildings (+1%); infinite environment i.e. not a box (+5%); particle effects (+5%); 3D landscape (+5%); advanced camera motion e.g. quaternions, complicated flight path (+5%); complex cityscape (+5%); motion blur (+3%); anything else you can think of, ask me :)
Submission Requirements
You must submit:
1) Your movie
2) The .city file you created
3) The code you used to load and render the cityscapes
4) Additional items such as ground/sky/etc. textures and associated model files (do not submit the building models you used for your city - we already have them!)
5) A Readme.txt file should be supplied to describe your submission and how to run your code. This file should also indicate the time in your movie at which the building you designed is visible. It should also explain where in the code to find pre-defined camera path functionality, and where glReadPixels() is used.
The .city files will be tested in our own renderer to make sure they follow the correct file format, so please ensure you follow the format precisely. Do not submit the building models you used for your city - we already have them! Make sure you have not renamed any of the directories or model names for your city.
We check the code and the .model files for similarities. It is against university policy to copy or share individual work submitted for assignments.
Useful Links
1)Existing models - List of models (with screenshots)
2)Image stitching (combine images) - AutoStitch (Windows only)
3)Image manipulation - The GIMP (all platforms),
4)Perspective correction and cropping of images - tutorial using The GIMP
5)Image converter (for PPM) - XnView (Windows mainly), IrfanView (Windows), The GIMP (all platforms), ImageMagick (all platforms), jpg2ppm (Mac). If possible, use XnView or jpg2ppm, since these can very easily do batch conversion.
6)Read/write for PPM files - PPM.zip
7)Texture mapping tutorial - Nehe @ GameDev
8)Making a movie from a sequence of images - Bmp2Avi (GUI version, Windows), Bmp2Avi (command-line version, Windows), Time Lapse Assembler (Mac, recommended) FramedX (Mac, only try if Time Lapse Assembler doesn’t work), tutorial for using Quicktime (plugin, Mac)