CS 475/675 Assignment 4 (Droids - Animation)

Table of Contents

1 Making the recording interface and correctly saving the keyframes file

The state of the robots, lights and camera can be recorded by pressing `F'. The state is appended to `keyframes.yaml' file. yaml format was used mainly because of the readability of the created file, rather than to avoid parsing text.

2 Correct interpolation in playback mode

`P' is binded to the interpolation and playback function. It reads all the key frames from `keyframes.yaml' interpolates between them and plays them back. For simplicity we have used a constant number of frames between key frames.

Instead of `P', if `R' is used the intermediate frames are copied from the framebuffer and stored to a file.

3 Correct use of glfw timers for playback

While playing back using `P', glfw timers in particular glfwGetTime is used to pace the frames at the required rate. The core timing code from main.cpp is:

frame_start = glfwGetTime();

renderGL();
env.draw();
glfwPollEvents();

draw_time = glfwGetTime() - frame_start;

sleep_time_ms = int(1000.0*(frame_time - draw_time));
if( sleep_time_ms > 0.0 )
{
  std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time_ms));
}

glfwSwapBuffers(window);

In short the main thread is made to sleep for any time remaining after rendering a frame and polling for events.

4 Making the video and uploading to Youtube: 20 marks

In process as the due date for this part is Nov 27th.

5 Bonus: Move camera along a Bezier curve

a4/Bezier-curve-authoring.png

Authoring a Bezier curve

Functionality to move the camera along a Bezier curve has been implemented. To author a Bezier curve a 3D-cursor in the shape of a camera can be turned on by using the key `*'. This cursor can be moved to any position and orientation using the keybindings for moving an object (`TAB' is used to switch 'active object' status from one object to the next). At any point, the cursor's pose can be recorded using `+' and the last pose can be deleted using `-'. These recorded poses are uses as the coordinates of the control polygon, and corresponding Bezier curve is updated each time `+' or `-' is used.

Points on the curve can be sampled and used to animate the camera position on it.

6 Keyboard Bindings

Keyboard Bindings
keybinding
ESCquit application
tabswap controlled active object
jtoggle light 1
ktoggle light 2
ltoggle spot light
1bend forward at hip
2bend backward at hip
3bend left hand forward at elbow
4bend right hand forward at elbow
3r2d2: rotate head left
4r2d2: rotate head right
5bend left hand backward at elbow
6bend right hand backward at elbow
7bend arms backward at shoulder
8bend arms forward at shoulder
9bend arms up at shoulder
0bend arms down at shoulder
qmake humanoid robot walk
arrow keysrotate perspective camera
z, xmove perspective camera forward/backward
w, smove object along its z-axis
a, drotate robot about y axis
v,b,n,mmove object along its x, y axes
y,u,i,orotate object around its x, z axes

Author: Anshuman Kumar, Ravi Chalasani <anshu266man@gmail.com>

Date: Nov 6th, 2015