GOAL
In this assignment you will practice lighting and texture mapping on 3D objects, and scaling, rotation and translation using OpenGL (or WebGL).Oct 13, 2014 by end of day
Basic grading:
All assignment parts should be completely using Open/Web GL functionality. The components of this assignment will be graded as follows:- 10% Properly turned in assignment.
- 20% Render the complete triangles described in the obj file, in white
- 20% Add Blinn-Phong lighting to the triangles
- 30% Render the complete triangles described in the obj file and apply the texture using an image selected by user
- 20% Using keyboard and cursor keys (arrow keys) scale, rotate and translate the rendered object
- Participation credit: You can receive participation credit (outside of this assignment) for posting your release, good or bad, on the class forum!
General notes (Read carefully):
The assignment asks you to do lot of small things, each of which will not take much time. However start early. We anticipate you to take most time in figuring out how to map a texel to a pixel, but once you understand that, rest should be fairly simple.As before, we will test your program with the test cube, as well as several other obj files, some of which you can find here, others which you cannot. For texturing we are providing additional sample code (see below).
This time you are free to choose your window size, position of eye, type of projection (perspective or orthographic), and light position and color.
In order to use an image as texture, you should read an image file, store individual pixel information in a byte array and pass it to OpenGL. We are providing you a sample code which reads a 24-bit bitmap file and applies it to a randomly rotating cube. You may use this code to understand how texturing works and may also use this to get started with texturing (and rotation) for your assignment.
Each phase of this assignment overwrites the previous. We will assume that you completed parts <k if you complete part k.
Part 0: Properly turned in assignment
Submit files as specified by our TA, in a forthcoming post.
Part 1: Render white triangles
Use OpenGL to render triangles, not just vertices. You should see all objects rendered in pure white, with only the silhouette providing any detail.
Part 2: Render lit triangles
Now you can not ignore normals, and need to worry about depth. Turn on depth buffering, local Blinn-Phong lighting, Gouraud shading. You should also have a light source as described in the general notes for this part of the assignment. You should see the model with some sort of lighting and shading, with every triangle fragment having a slightly different color. You should also see occlusion.
Part 3: Render lit triangles blended with custom texture
Ignore the texture information in the obj file. Instead use the image you read as the texture.
Use a popup menu to let users choose from a list of different image files that may be used as texture. Picking a different image removes the first texture and applies the new one.Part 4: Scaling, Rotation and Translation
Let the user transform the rendered object as follows:
- Use "z" to zoom-in/scale-up the object
- Use "x" to zoom-out/scale-down the object
- Use "up-arrow" to move the object in +Y
- Use "down-arrow" to move the object in -Y
- Use "right-arrow" to move the object in +X
- Use "left-arrow" to move the object in -X
- Use "[" to move the object in +Z
- Use "]" to move the object in -Z
- Use "q" to rotate the view in clockwise direction
- Use "w" to rotate the view in anti-clockwise direction
Participation credit:
Please remember that you can get participation credit outside this assignment for posting your imagery, good or bad, on the course Google+ community.Extra credit grading:
Extra credit opportunities include the following, with others possible with instructor approval:- 5% support arbitrarily sized images (and interface windows)
- 5% support arbitrary viewing setups
- 5% support multiple lights at arbitrary locations
- up to 15% to support multiple image formats
Extra credit: Arbitrarily sized images and interface windows
Read in an additional window.txt file that one line, lists the width and height of the interface window. Size your interface window to match. This should effect every part of your assignment.
Extra credit: Support arbitrary viewing setups
Read in an additional view.txt file that lists the eye's location, the view up, and the look at vectors, each on a different line. Render the scene with these viewing parameters. Note that with bad viewing parameters, you will not see the model. This should affect every part of your assignment.
Extra credit: Multiple and arbitrarily located lights
Read in an additional lights.txt file that on each line, describes the location and color of a light (use one triple for a light's color, with its ambient, diffuse and specular colors the same). Render the scene with these lights. In ray casting, you will have to sum the colors all the lights. This should affect every part of your assignment.
Extra credit: Multiple image formats
We have provided you a sample code which uses 24-bit bmp files as textures. You are free to use this code, or write your own. To claim this extra credit, you must implement support for an additional format apart from 24-bit bmp. The extra credit for this will be calculated as follows:
- 5%: one or more of 8-bit, 16-bit or 32-bit bmp
- 10%: one or more of JPEG, PNG or TIFF
- 15%: a combination of the above two