Transformers - Animation
Overview
In this assignment we will model two Transformers.
Transformers are robots that can transform into various kinds of vehicles, objects or creatures. They originally are a toy line by Hasbro Inc., and have been adapted to movies and animation.
As an example, you can see these:
http://www.youtube.com/watch?v=veZck1MtX5g
https://www.youtube.com/watch?v=vgBK5-qMOyg
The overall aim of this and the next assignment is to create a short film with the transformers of your own design. In this part of the assignment you will animate the transformers.
Animation Overview
In the previous part of the assignment you created two transformers robot that can change into another object at the press of a key, added controls to move the object and the transformer, added lighting and texture. In this part, you create the animation for the transformers.
Ideally, you would make a small story that you want to tell through your animation. Then program the keyframe recorder and player as explained below. Save the frames of your animation to images and add a soundtrack. Finally, you must upload your animations to youtube and submit the youtube link in your readme file.
Scene Setup To Do:
- Model a scene - this can be an outdoor or indoor scene. Model necessary geometry for the scene, color and light it appropriately so that it renders clearly. Scale the scene properly and place your transformers in it.
Setting up cameras -
- Create a perspective camera and position it such it can see your entire scene. This is camera 1.
- Create a perspective camera that follows (always looks at and moves with) the first transformer as it moves (called a 3rd person camera). This is camera 2. Similarly have camera 3 follow the second transformer. This should work in both robot and non-robot modes.
- Add a key to toggle between these three cameras at runtime.
Setting up lighting -
- Create two (or more, at least two is mandatory) point lights and place them appropriately so that they light up your scene. Implement at least a Gouraud shader. You can change this to a per-pixel shader if you want.
- Add keys to switch these lights on/off.
- Add lights to the transformers that move with them, for eg. vehicle headlights. Add a key to toggle this on/off on each transformer. Make sure the headlight lights up the scene in front of the transformer appropriately.
- Make sure the textures on all the models - the robots and the scene - are lit properly when lighting is turned on.
Setting up texturing -
- Create a skybox or bounding sphere with an environment map that should surround your entire scene. Make sure your lights and cameras are inside this bounding geometry.
- Make sure the textures on all the geometry models are lit properly when lighting is turned on.
Animation To Do:
Keyframes
Every parameter that you can modify in your scene - the state of various lights, positions of cameras, the mode of the transformers T1 and T2 (robot/non-robot), the overall translation and rotation of the transformers, the pose of the transformers (in any mode) - can be animated. Design a keyframe format. A line in your keyframes file will look like as follows:
<time-stamp>…. <light1-state> <light2-state> <light2-state>…. <Camera-EyeX> <Camera-EyeY> .. <Camera-LookAtX> <Camera-LookAtY> … <T1-Mode> <T1-Translation-X> <T1-Translation-Y>… <T2-Translation-X>… <T1-Neck-RotationX> <T1-Neck-RotationY>… <T2-Elbow-RotationX>…..
Here are some guidelines for the keyframe file:
- This is a text file. Each item within <..> in a line represents a parameter value (your file will contain only the values - not the angular brackets).
- You can decide the number of fields you want, but it must be same throughout your keyframe file.
- Some parameters, like the light state, may only be 0/1 values indicating on/off and others may be real numbers. Decide according to usage.
- The time stamp should be in number of frames. It is a whole number.
Authoring and Playback
In order to generate the keyframes, and create the animation you have to implement the following:
- Create a program that implements everything asked above in terms of cameras, lighting and textures with the scene and two transformers. Make sure all your keyboard controls for moving and posing the transformers (in both modes), for changing the cameras and lights work in this program. This program must compile to an executable called tf-animate.
- Define a key S that saves the current state of your scene as a line in a keyframes file called keyframes.txt.
- You can enter the timestamp when S is pressed in the console or you can have a default value of the keyframe increment such that every time you save a keyframe, the timestamp increments by 10 frames. You can edit the keyframes.txt file later in a text editor to adjust the timestamps if needed.
- Now define a key L that reads the keyframes from the keyframes.txt file. Report on the console/terminal how many keyframes you read from the file.
- After the keyframes have been loaded, pressing the P key should playback the animation. For animating, interpolate between the keyframe, generating one frame for each time step. So if keyframe 1 has a timestamp 1 and keyframe 2 has a timestamp 15, the you will generate and render 15 frames between these keyframes using interpolation. Some values in the keyframe should not be interpolated, e.g., light state - you can decide this according to your keyframe format and design.
- You must use a GLFW timer callback to playback your animation at a particular frame rate - do not just put in a global loop with a sleep().
- After you are satisfied with your animation, pressing a key R should start a record mode for your animation. The same animation as before plays back, but now you capture the framebuffer at each time step to an image. Name your frames as frame-00000.xyz, frame-00001.xyz and so on, where the extension xyz will depend upon what image format you save to. Make sure you have enough disc space to save the frames before you enable this mode.
- Code for saving the OpenGL framebuffer to an image can be found in Tutorial 8 of the OpenGL tutorials for the course.
- While making the animation, it is a good idea to have a script so that your animation tells a story. Explain this script in your report.
- Decide a frames per second rate (FPS) for your animation - actually you should do this early on. For e.g., if you decide on a fps of 30fps, then 10 frames represent 1/3 seconds of animation. This will help you create timestamps for your keyframes. Do not choose a FPS less than 5.
- The entire duration of your animation must at least be 60 seconds. You can generate longer animations if your want.
Movie and Reporting To Do :
Making a movie -
- You movie should be at least 1 minute long
- Join the frames saved above into a movie file. You can do this using ffmpeg or avconv on linux,
- If you want, you can add music or sound effects to your movie file by either using ffmpeg/avconv or using editors like OpenShot.
- If you add a soundtrack, make sure you do not use copyrighted music.
- Upload your movie to youtube.
- Make sure you add the link to it to your report and github README file.
- Take a frame of your movie. Save it as a jpg. Name this file as <partner1-rollnumber>-<partner2-rollnumber>.jpg. If you are working alone, use <partner1-rollnumber>-nil.Upload this single frame of your movie to the doc folder of your repository.
- Do NOT upload your movie or all frames to your Github repository.
Report Submission -
- Write a pdf report containing details of your lighting, texture and camera choices. Explain the script of your animation briefly.
- Add the youtube url of your movie to the report. Name this report file report.pdf. Make sure you include the names of both members of your group in the report. Put the report in the doc folder in the repository tree.
Preparation
- The assignment is to be maintained and submitted via Github Classroom.
- Make sure you have a github.com account and have access to it before proceeding.
- Read these instructions about how to get started with assignments on github.
- Click on the assignment invitation link sent on the MS Teams channel for the course to begin.
- Choose the same group/team as the previous assignment on Github Classroom.
Do NOT do the following:
- Write untidy or unorganized code. This will be penalized.
- Submit a repository that does not conform to the expected structure or has extra files. Make sure that at submission time your archive contains only source files, shaders, final keyframes.txt file, texture images and the report. No temporary files, executables, object files or other files must be present.
- You must not change the hierarchy of the transformers from A2 - you must animate the same transformers.
- Do not have a .gitignore file that prevents you from uploading your texture images - otherwise we will not be able to run the code you submit.
- Do not name the submitted movie frame incorrectly.
- Do not forget to include the youtube link for your movie.
Plagiarism policy
Do NOT plagiarize code. We will check all submissions for copying.
Marking
- Camera 1, 2 and 3 with a key to toggle between them: 150 marks
- Point lights + key to switch on/off: 50 marks
- Light on both Transformers + key to switch on/off: 50 marks
- Indoor or Outdoor Scene with appropriate geometry and colour: 100 marks
- Bounding geometry (skybox) environment map: 100 marks
- Texture and lighting working together: 50 marks
- Keyframe saving: 50 marks
- Keyframe loading: 30 marks
- Keyframe playback with interpolation in timer callback: 150 marks
- Saving frames and movie link: 50 marks
- PDF report with details of light, camera and texture, script of story and link to video: 50 marks
- Movie screenshot/frame in doc folder: 20 marks
- Total: 850 marks
- Deductions: Inconsistently written code: 50 marks
- Deductions: Submitting an unclean archive: 50 marks.
- Deductions: Missing README and/or declaration: 100 marks
- Deductions: For every late day beyond the deadline, you will lose 25% marks. So up to 1 day late, you will be graded out of 75% marks, from 1 to 2 day late out of 50% marks, from 2 to 3 day late out of 25% marks, and beyond that no marks.
Important Note
Please do not put your solution code and report anywhere public. It should not be available online.
To Submit
- Regularly check-in the code into your teams' github repository.
- The last check-in before the deadline will be considered for marking.
- Modify the README.md file in the repository root folder stating the names and roll numbers of your partner for the assignment, and a declaration in your own words that the assignment is your own work and that you have not copied it from anywhere.
- Also cite any sources that you may have used to complete it.