Homework 6: A Whole New World
Short Description:
Write a program that allows the user to explore a virtual world of your creation.
This assignment is worth 30 points.
Goals
When you finish this homework, you should
- Implemented a program that employs a camera and prospective transformation.
- Implemented movement in a 2-D plane.
- Implemented controls for camera and movement.
- Created an ground model.
Formal Description
Build a three dimensional world which can explored. The world should include
- A model of the ground, roughly located from (-100,0,-100) to (100,0,100).
- A number of models placed in this world.
- A movable camera.
- A display showing camera conditions.
Ground Model
You should create a ground model. This should be implemented as triangles and eventually displayable as a Scene Object from homework 5. If you were unable to complete homework 5 but would like a copy of the scene object please contact your instructor.
This object should be modeled in the x-z plane and should have 201 lines in the x direction and 201 lines in the z direction. When scaling to the size of the world you are creating, the "ground" should have lines intersecting at each integer coordinate pair in the x-z plane.
You may, if you wish, include variation in the y coordinate. This will provide something other than a flat land. Consider random noise or a trig function.
Other Models
Place other models in your world to make it interesting. You must, however, have the following objects in your scene:
- Origin(al) Lizard: The lizard model must be at the origin (0,0) facing north (along the positive Z axis. He must be standing on the "ground", and be 10 units tall. His head must be the highest point.
- North Teapot: The teapot must be centered at (0,10,100). It should be scaled in each dimension by 3. The top of the teapot should be pointing up (0,1,0). This should be 7-10 units above the ground.
- The Epcot of the East: The epcot model must be centered at (100, 11, 0). It should be scaled by 20 in each dimension. This should be just slightly above the ground.
- The Skeleton of the South: At least one skeleton must be at (0,0,-100) standing 2 units tall and facing north. This should be standing on the ground. Any other skeletons at this location should be less than 1.5 units tall.
- The Guardian best of the West: Place the bunny at (-100,0,0). It should be small (approximately .3 units ) and looking toward the east (0,0,100), and sitting on the ground.
If your ground is not flat, you may adjust these models so they are on the ground (lizard, bunny, skeleton), intersecting the ground at an appropriate location(epcot) or above the ground by 7 units (teapot).
You may place other models in the scene at your will. I will consider bonus points for creative worlds.
Camera
Provide a means for the player to explore your world. This should be implemented via the field of view projection interface. The player should be able to move about moving the following key commands
- w: move forward along the current vector by 1 unit.
- d: rotate the current movement vector to the right by 5 degrees.
- a: rotate the current movement vector to the left by 5 degrees.
- s: move backwards along the current vector by 1 unit.
- b: move the near plane backward by .1 unit.
- n: move the near plane forward by .1 unit.
- c: decrease the field of view angle by 1 degree.
- v: increase the field of view angel by 1 degree.
- <: decrease the aspect ratio by .1
- >: increase the aspect ration by .1
- h: move the look at position 1 degree to the left.
- l: move the look at position 1 degree to the right.
- j: move the look at position 1 degree up.
- k: move the look at position 1 degree down.
- r: reset all values to original position.
The camera should start at (0,2,-20) and be heading North. Movement should be restricted to the area(-99,0,-99) to (99,0,99). In other words, you should not be able to walk off the edge of the world.
The direction of travel should be controlled by an angle. You can use polar coordinates to control this. This should be set so a forward movement moves the camera towards the lizard.
The near plane should start at a reasonable position and be restricted to be between .1 and the location of the back plane. The back plan should be 30 units away.
The field of view angle should be between 20 degrees and 180 degrees. It should begin at 90 degrees.
The aspect ration should be between .1 and 2. It should begin at 1.
The look at position should be the (0,2,0).
Camera Position Display
Finally you must implement a display which shows camera location and conditions. Each time the "player" moves, this should be updated.
Your display should be updated for your camera type.
Additional Features
If you wish, you may add additional features. These include