In this assignment you will extend the view3D from PA2 to render animated textured scenes.
The given support code parses an input X3D file, partially constructs a scene graph, inserting various X3D nodes into it, and then passes the scene to OpenGL for rendering. The X3D file format is described in the X3D Specification. Most tasks require modifying the scene.cpp file (as usual, look for ``YOUR CODE HERE''). As part of your assignment you will need to create an example X3D scene file that will show an animated humanoid character moving through a scene.
|The first three tasks of this assignment familiarize you with how texturing fits into a scene graph. The first two tasks should be easy peasy for you by now. The third one introduces you to texture transform. When you build the provided code as is, you will likely get warnings about the index variable being not used in various functions in scene.cpp. You can ignore these warnings for now. The index variable will be used by your code. As is, view3D will display scenes/aclock.x3d as shown on the right.|
1. Texture Setup. The provided view3D application
can load texture image
from a JPEG or PNG file and store it as an object of Image
class (image_ points to the image). To
enable texturing, you need to generate a new OpenGL texture handle
(ID) and set up OpenGL for texturing. Modify
2. Textured Cylinder. When rendering geometry, you need to
specify texture coordinates for each vertex. Modify the
3. Texture Transforms. OpenGL can apply tranformations to
specified texture coordinates before using them. Modify
4. Linear interpolation. The provided support code has
some basic animation capability in
5. Spline Interpolation. Implement spline interpolation
for the X3ScalarInterpolator and X3PositionInterpolator
classes to enable animated content rendering--with smoothly
varying parameters, as well as to enable rendering of
smooth X3Curve. Use the Catmull-Rom splines (with tension zero) to
produce smooth interpolation. You only need to implement smooth
interpolation for the scalar and position values, not
rotations (which would require use of quaternions). For easier debugging,
use the X3Curve node to draw a curve in space (|
6. Humanoid Walking. Create an X3D scene file that
renders an animated humanoid walking through some scene. For
full credit, the character should be textured, have two legs
(comprised of upper legs, lower legs, and feet), two arms, a
body, a head, and exhibit a proper walk cycle. The walking
should propagate the character through the scene at the
appropriate rate without sliding. It is acceptable to use
cylinders and boxes for rendering the character. This is 55% of
the assignment; be sure to treat it as such!
The animated humanoid must be modeled as an articulated
hierarchical character model. You must tie together
Link, is introduced to bind together three components required for animation, namely, timers, interpolators, and fields to be updated. Specifically, each
Linkstores the pointer to the field to be updated, and it references the
Interpolatornodes. In each frame, before the rendering pass, each
Linkupdates the value of the field by the value produced by the
Interpolatornode has its
<key, value>sequence as attributes read from the X3D file. Each
Interpolatormay be used in multiple instances: for example, a pendulum orientation interpolator may be reused in several different clock gadgets present in the scene. All of these gadgets would go through the same sequence of orientations, even if the gadgets have different speeds and are not synchronized with each other. The gadgets use the same
Timers to drive the
Interpolator. Thus, for each gadget a separate
Linknode will be used to refer to the same
Timers. The role of the
Timeris to take a current global time and perform a timing transformation on it. Schematically, a single update operation for a
L, can be represented as:
L.field_pointer = L.interpolator.Evaluate(L.timer.ConvertTime(t)), where
tis the current global time. Global time runs in sync with the system clock, however it may be paused and restarted by the application.
Timernodes define time conversion from global time to a warped time used as a parameter to the interpolator. A timer has two attributes: period and shift.
Timers with positive periods are periodic, they produce values between zero and one. Therefore, in order to produce periodic motion, one should define
Interpolators whose key sequence starts at zero and ends at one. To avoid abrupt transitions at the end of each cycle, the periodic
Interpolatorshould have the same starting and ending values in its value sequence. A
Timerwith a negative period attribute is non-periodic, it simply scales the input time by 1/(-period). This can be used with
Interpolators that have no restrictions on their key sequence (as long as it is increasing). Please refer to X3Timer::ConvertTime() method for more information.
Interpolatormaps its input time into a value. The parameters of the mapping are the key and value sequences specified in the corresponding attributes in the X3D file. Depending on the output value, we define three interpolator classes:
Interpolators implement piecewise linear or cubic Catmull-Rom spline interpolation. Orientation
Interpolators will not use smooth interpolation (which requires use of quaternions).
Linknode can appear anywhere within the scene, and has four required attributes:
Interpolator. Again the attribute should contain a name of such node defined earlier in the scene file. In order for a node to accept values into one of its fields, it needs to process the field's name using its GetFieldPointer method (see the X3Transform::GetFieldPointer() for an example).
Linknode is not part of the X3D standard. It is introduced in this assignment to define update relations.) The diagram below shows an example arrangement with two links using two different
Interpolators, and two updated fields.
Timers. For example, in the following diagram, the two
Links use the same
Timers. Therefore, the same sequence of 3D vector values will be placed into the two updated fields, possibly with some delays. Or perhaps the values in the translation field of the transformation node will change more quickly (since it is using the "timer_fast"
Timerwhich may indicate a shorter period value). In a similar fashion, a single
Timercan be used to drive two different
Download the assignment archive from /afs/umich.edu/class/eecs487/f15/FILES/pa4.tgz.
The program view3D should be called with one command-line argument--the name of an X3D scene file. We have included a few in the scenes sub folder. The code needs to be linked against the png, jpeg, expat and the usual OpenGL, GLU, and GLUT libraries; and its compilation requires the corresponding header files. For instructions on how to install these libraries, please see the course note. Your code must not require other external libraries or include files other than the ones included in the support code or listed in this spec (e.g., do not include xmat.h, you don't need it).
The following keyboard shortcuts are defined
view3D (you may bind other operations to keys
view3D.cpp:kbd(), but do not change these
As with PA1, to incorporate publicly available code in your solution is considered cheating in this course. To pass off the implementation of an algorithm as that of another is also considered cheating. For example, if the assignment asks you to implement sort using heap sort and you turn in a working program that uses insertion sort in place of the heap sort, it will be considered cheating. If you can not implement a required algorithm, you must inform the teaching staff when turning in your assignment, e.g., by documenting it in your writeup.
Test the compilation!
Code that does not compile will be heavily penalized.
Create a writeup in text format that discusses:
Your "PA4 files" then consists only of
scene.cpp, your humanoid walking scene file from Task 6
(which MUST be named walk.x3d), and new texture file(s)
you use as part of Task 6.
To turn in your PA4, upload a zipped or gzipped tarball of your PA4 files to the CTools Drop Box. Keep your own backup copy! The timestamp on your uploaded file will be your time of submission. If this is past the deadline, your submission will be considered late. You are allowed multiple "submissions" without late-policy implications as long as you respect the deadline.Turn in ONLY the files you have modified. Do not turn in support code we provided that you haven't modified. Do not turn in any binary files (object, executable, dll, library, or image files) with your assignment. Your code must not require other external libraries and include files other than the ones listed in the Makefile.
Do remove all printf()'s or cout's and cerr's you've added for debugging purposes.
The General Information section from PA1 applies. Please review it if you haven't read it or would like to refresh your memory.