A Trajectory among Blender Objects
Due: Monday, December 18
You shall create a virtual environment through which the user can move the camera. The objects in the environment should be created via Blender 3D and saved as Wavefront (.obj) files.
Specifications:
- The image should use the standard OpenGL shading (i.e. Phong) model.
- There should be at least 6 objects in the scene, including 2 pairs of duplicates.
- All objects should be rendered either via a simple GL material, or with a texture (or both). The environment should contain at least one textured object.
- The shape of the objects should be a reasonable approximation of "real life" objects--no regular polyhedra please! They don't have to be particularly complicated, though. Perhaps you can whip up a car, a chair, whatever. I'm concerned with the shape here, not their material or texture.
- Upon program start-up, the camera should traverse a trajectory through the scene. This trajectory should be a Bezier or interpolated cubic curve. You might want to use the code (prog8BezierCurve.c, from Hearns & Baker) we reviewed in class to generate the trajectory. Alternatively, you can use the OpenGL Map functions in the other code (curves.c, from Angel) we discussed in class. You might leave mouse movement (as described below) turned on during camera movement along the trajectory so that the camera can be rotated as it follows the trajectory.
- After following the initial trajectory, the user should be able to move the camera through the environment: the W and S keys should cause the camera to move forward and backward, respectively. Mouse movement to the left should cause the camera to spin to the left. Mouse movement to the right should cause the camera to spin to the right. So, by judicious use of the mouse and 'W' and 'S', the user should be able to direct the camera through the scene.
- Place the lighting to do a good job of illuminating your objects. Use at least some ambient light so that areas not illuminated by a light are still visible.
- Extra Credit 1: Use the 'T' key to switch to trajectory definition mode. The screen should show an overhead view of the scene. The user clicks the mouse 4 times to define control points of the curve. See curves.c for a good way to do this. Indeed, you might want to use this tool to define the initial camera trajectory of your program. Upon defining the control points, use the B or I key to define the curve (show it on the overhead shot). The E key erases the control point, allowing the user to define 4 new ones. Once satisfied, the R key should switch back to the camera's view with the camera traversing the newly defined trajectory.
- Extra Credit 2: add a collision detection mechanism so that the camera cannot move "through" objects but instead stops upon "bumping up against" the object. The easiest way to do this is via an approximation: if the position of the camera would be inside a bounding rectangular prism surrounding the object, consider that to be a "collision".
Hints:
Feel free to make use of the code examples referenced above to help with the generation of your own program.
Submission:
Submit your source code to the submission system, http://caddis.acad.emich.edu/~hwmatt/student/. Provide hardcopy at the final exam.