Assignment 6: Transfomations
- Due May 20, 2018 by 11:59pm
- Points 9
- Submitting a file upload
Objectives:
To transform our models with basic matrix transformations.
Description:
In this assignment, we will pass transformation matrices to the shader to allow us to transform our models in a more general sense. To do so, you will need to specify the vertices of your objects in object coordinates. That is, the (x,y,z) locations of your vertices should be relative to the center of your object. Then, the object's final position is determined by multiplying the point by a set of transformations matrices. That is, you will never actually change the vertex coordinates of your shape, you will only change it's associated transformation matrices. The simplest way to do this is make a uniform matrix 'u_ModelMatrix' which will accumulate all of your transformations (as shown in some of the examples).
Resources:
Rotated and Translated Triangle Links to an external site. <-- Located in Matsuda/Lea Chapter 4
Scaled Triangle Links to an external site. <-- Located in Matsuda/Lea Chapter 3 (note that this examples calls its transformation/model matrix 'u_xformMatrix', but it has the same function as 'u_ModelMatrix')
Animated Transformed Triangle Links to an external site. <-- Located in Matsuda/Lea Chapter 4
Combining View/Projection/Transformation Links to an external site. <-- Located in Matsuda/Lea Chapter 7 (note that this example combines the model, view, and projection matrices into one 'u_MvpMatrix'. It is suggested to keep your matrices separate for simplicity and clarity)
Chapters 3 and 4 of Matsuda/Lea are most helpful for transformations.
Starter code has been posted in the Files tab under 'Examples/StarterCode'.
Rubric
Criteria | Ratings | Pts |
---|---|---|
1r. The user can click on an object to select it. Selected objects are highlighted. If the background is clicked, all objects are unselected.
This should have been implemented in Assignment 5. Also like the required point in Assignment 5, it's OK if you only have on object on screen.
threshold:
pts
|
pts
--
|
|
2r. If the user holds down the left click and drags across the screen, the currently selected object is translated accordingly within the xy-plane.
The object should follow the mouse. If the object is, for some reason (perhaps the projection), slightly off from the cursor, but still follows the general movements, that is OK (ask in lab if you have specific concerns about your submission). For this point, you do not have to implement translation along the z-axis.
threshold:
pts
|
pts
--
|
|
3r. If the user scrolls with the scroll wheel, the currently selected object is scaled accordingly. If you don't have easy access to a scroll wheel, it's Ok if you bind the scaling transformation to a different set of controls.
Scaling should scale the object in place. That is, scaling won't also move the object.
It doesn't matter whether a positive scroll is an increase in size or the other way around, but we should be able to both increase and decrease the scale of the object. To get the scroll wheel info: https://developer.mozilla.org/en-US/docs/Web/Events/wheel
threshold:
pts
|
pts
--
|
|
4r. If the user holds down the right click and drags across the screen, the currently selected object is rotated accordingly.
Rotation should rotate in place. That is, rotating won't also move the object.
Make it so that left-right movement rotates the object about the y-axis and up-down movement rotates the object about the x-axis. You do not have to implement rotation about the z-axis for this point.
threshold:
pts
|
pts
--
|
|
5r. Lighting should match translations.
For full credit, make sure lighting is correct for at least the Phong lighting model (with specular, ambient, and diffuse). However, if you transform your points and normals correctly, and wrote your shaders correctly, this point should be automatic after implementing transformations.
threshold:
pts
|
pts
--
|
|
1e. If the user holds down the middle mouse button (scroll wheel) and moves the mouse up and down, the currently selected object is translated accordingly along the z-axis.
If the mouse is moved up, then the object should move away from the viewer. If the mouse is moved down, the object should be moved towards the viewer.
Note that this transformation might be subtle (it might just look like a scale). So, make sure that the grader can tell that this is working (lighting is the easiest way to prove this). If there are any doubts about your submission, ask in lab.
threshold:
pts
|
pts
--
|
|
2e. If the user holds down the middle mouse button (scroll wheel) and moves the mouse left and right, the currently selected object is rotated along the z-axis.
Rotation should rotate in place. That is, rotating won't also move the object.
threshold:
pts
|
pts
--
|
|
3e. Correctly handle multiple objects. That is, transforming one object has no effect on the other objects in the scene.
To do this, you'll need some way of giving each object it's own transformation/model matrix.
threshold:
pts
|
pts
--
|
|
4e. Have an object in your scene that emits light (as a point light source) and be able to transform it.
For example, make a solid yellow cube that the user can click and drag around the scene to change the lighting. For full credit, the lighting must match the transformations.
threshold:
pts
|
pts
--
|
|
5e. Make a button that, when pressed, makes all of the objects in your scene spin about the y-axis indefinitely.
threshold:
pts
|
pts
--
|
|
6e. Have a button that, when pressed, makes all of the objects in your scene move in a square path in the xy-plane.
For example, you can make the objects move left a little, then up, then right, then down.
threshold:
pts
|
pts
--
|
|
7e. Have a button that, when clicked, causes all of your objects to fall as if there was gravity.
threshold:
pts
|
pts
--
|
|
8e. Be able to apply a shear transformation.
Direction of shear and method of control are up to the student, however, make sure to be clear.
threshold:
pts
|
pts
--
|
|
9e. Be able to apply a twist transformation.
Direction of twist and method of control are up to the student, however, make sure to be clear.
threshold:
pts
|
pts
--
|