Assignment 8: Texture Mapping
- Due Jun 3, 2018 by 11:59pm
- Points 9
- Submitting a file upload
- Available until Jun 8, 2018 at 11:59pm
Objectives:
User a higher level library to map textures onto various geometries.
Description:
In this assignment, you will be mapping textures to models in your scene. Textures are, in a very simple sense, just images, and are used in many different applications in computer graphics. For example, if you want your model to look scaly, you can take a picture of the skin of a lizard, and wrap that image around your model (the alternative being painstakingly coloring each triangle on your model).
The act of mapping your textures to your models is a matter of specifying texture coordinates to each of your vertices. To visualize this, imagine your texture image as a rubber sheet. Mapping a texture is then deciding where and how to stretch and squeeze your texture around the object. Do we wrap it around completely? Do we tile the texture across the surface? Do we paste it on backwards? So a texture coordinate just says, for each point on our model, which point on the texture it corresponds to.
For the required points, you will perform two texture mapping techniques:
- 2D Texture mapping: Here, we simply take a 2D image and somehow 'paste' it onto a 2D surface.
- Environment mapping: Here, we treat the surrounding environment as a texture (in particular, we will use a skybox), and map the environment onto the model, making it look like a reflective surface.
How to Proceed:
This lab is different from the previous labs because we will be giving you a fresh library which sums up all of the things you've implemented this past quarter. The library is somewhat based on the 'three.js Links to an external site.' graphics library, which is a heavily used graphics library for web development. Thus, you won't actually be implementing your own texture mapping code.
In the starter code we give you, your scene already contains some geometries, with some textures mapped to them. Study the 'driver.js' code, as the calls made within the 'start()' function are pretty much all you need to complete most of the required points. For the required points, you should not have to mess with the library provided to you. However, you may find it beneficial/interesting to take a peek and to compare/contrast the library with what you have been writing this quarter.
We will go over the library in more detail in lab.
Resources:
Starter code is located in 'Files/Examples/StarterCode/Assignment8StarterCode_v1'
Rubric
Criteria | Ratings | Pts |
---|---|---|
1r. Have a 2D plane with a single texture mapped side-by-side.
If you're texture is a picture of a stick figure, we should see two stick figures on the same plane side-by-side.
threshold:
pts
|
pts
--
|
|
2r. Have a cube with the same texture mapped to each face.
threshold:
pts
|
pts
--
|
|
3r. Have a sky box.
This will involved having a large cube around the scene, with a different texture mapped to each face giving the illusion that we're in a real space. You are free (and encouraged to) use the provided textures.
threshold:
pts
|
pts
--
|
|
4r. Have a sphere which reflects the sky box (environment mapping).
threshold:
pts
|
pts
--
|
|
5r. Be able to pan and rotate the camera with mouse.
At a minimum, we should be able to move the camera enough so that we can see all sides of the models.
You don't have to have controls as complex as in the last assignment.
threshold:
pts
|
pts
--
|
|
1e. Have a pyramid with environment mapping in your scene.
threshold:
pts
|
pts
--
|
|
2e. Have a button to load a new set of textures for the skybox.
User can load a new set of 6 textures to update the skybox.
threshold:
pts
|
pts
--
|
|
3e. Have buttons to increase and decrease the size of the plane.
As the user increases the size of the plane, one should see more textures side-by-side (instead of stretching the texture).
threshold:
pts
|
pts
--
|
|
4e. Add a base color to the cube and mix it with the color from the texture.
Add a color value per vertex of the cube and change the cube fragment shader to mix this color with the color coming from the texture.
threshold:
pts
|
pts
--
|