[SOLVED] graph OpenGL Computer Graphics, Fall 2018

$25

File Name: graph_OpenGL_Computer_Graphics,_Fall_2018.zip
File Size: 386.22 KB

5/5 - (1 vote)

Computer Graphics, Fall 2018
Michael Kazhdan

Assignment 3: OpenGL Rendering
Due on November 21 (Thursday) at 11:59 PM

Announcements
If you are working on a Mac and are seeing a black screen (when you should be seeing geometry), try resizing the window. Apparently there is an issue with Mojave that OpenGL windows are drawn in black until the window is resized.
[10/24/19] The code-base has been changed so that Ray::AffineShape::drawOpenGL passes the call to drawOpenGL to _shape. If you want to make the change locally, change the line: THROW( method undefined ); to WARN_ONCE( method undefined );
_shape->drawOpenGL( glslProgram );
[11/04/19] If you are working on Windows, you may need glut64.dll to run your executable. (It should compile without it). The Assignments.zip repo has been updated to include the dynamically-linked library, or you can download it here. If you do download the glut64.dll file, be sure to place it into the directory with your executables.
[11/12/19] Updated the Assignment3.exe executable to support spot lights.

Overview
This assignment serves as an introduction to the OpenGL graphics library. You will be required to generate a room scene which can be navigated in a walk-through fashion. You will begin the project by implementing the OpenGL analogs of many of the methods that you have implemented for the last ray-tracer assignment. Emphasis is placed both upon the implemention of OpenGLs basic capabilities (e.g. shading. lighting, transparency, materials properties, etc.) and their use in generating more involved effects (e.g. shadows, reflections.)For this assignment you will continue with the code base from the previous assignment, implementing the OpenGL related methods. There are some small modifications that you will need to make to your code described in the Code Modifications section below. It is highly recommended that you make a copy of your old code before you start working on the new methods.

An overview of the code you will be using can be found here or downloaded here.
An overview of the .ray file syntax can be found here.
A (Windows x64) compiled version of the renderer implementing some of the basic features can be found here. (If that does not work, try this one.)
The OpenGL programming Guide is an invaluable resource in assisting with OpenGL implementation. You can find a link to the guide here.

Getting Started
You should use the same code-base as in previous assignments (Assignments.zip), as a starting point. As in the previous assignments, code modification should be relegated to the *.todo.cpp files.
After you copy the provided files to your directory, the first thing to do is compile the program. To do this, you will first have to compile the JPEG library and then compile the assignment3 executable.
On a Windows Machine
Begin by double-clicking on Assignments.sln to open the workspace in Microsoft Visual Studios.
Compile the Assignment3 executable by right-clicking on Assignment3 and selecting Build. (If the JPEG.lib, Image.lib, Ray.lib, and Util.lib libraries have not already been compiled, they will be compiled first.)
The executable Assignment3.exe is compiled in Release mode for the 64-bit architecture and will be placed in the root directory.
On a Linux Machine
Type make -f Makefile3 to compile the Assignment3 executable. (If the libImage.a, libRay.a, and libUtil.a libraries have not already been compiled, they will be compiled first.) This assumes that JPEG libraries have already been installed on your machine. (If it hasnt been installed yet, you can install it by typing sudo apt-get install libjpeg-dev.)
The executable Assignment3 is compiled in Release mode and will be placed in the root directory.
If you are having trouble linking either to the gl libraries or the glu libraries, you should install the associated packages: sudo apt-get install libgl1-mesa-dev libglu1-mesa-devFor subsequent assignments, you should also install the glut package: sudo apt-get install freeglut3-dev

Code Modifications
The code you will be starting with in this assignment is essentially the same code you used for the previous assignment. However, there are a few small changes:
For those of you who have not (properly) implemented the Shape::updateBoundingBox for the different subclasses of Shape, implementation of these methods is provided for this assignment. (The method is needed to determine the center and radius of the scene.) The changes can be found in the following files:
Ray/box.todo.cpp
Ray/cone.todo.cpp
Ray/cylinder.todo.cpp
Ray/shapeList.todo.cpp
Ray/sphere.todo.cpp
Ray/torus.todo.cpp
Ray/triangle.todo.cpp

How the Program Works
The program takes in as a mandatory arguments the input (.ray) .ray file name. Additionally, you can also pass in the dimensions of the viewing window and the complexity of the tesselation for objects like the sphere, the cylinder, and the cone. It is invoked from the command line with:
% Assignment3 in in.ray width w height h cplx c
Feel free to add new arguments to deal with the new functionalities you are implementing. Just make sure they are documented.

What You Have to Do
The assignment is worth 30 points. The following is a list of features that you may implement. The number in parentheses corresponds to how many points it is worth.
(1) Implement the Ray::Camera::drawOpenGL (in Ray/camera.todo.cpp) to draw the camera.
(1) Implement the Ray::ShapeList::drawOpenGL (in Ray/shapeList.todo.cpp) to draw the scene-graph nodes. For now, ignore the input glslProgram parameter.
(2) Implement the Ray::TriangleList::drawOpenGl (in Ray/shapeList.todo.cpp) and Ray::Triangle::drawOpenGL (in Ray/triangle.todo.cpp) method to draw triangles with per-vertex normals. For now, ignore the texture coordinates and the glslProgram parameter.
(2) Implement the Ray::Sphere::drawOpenGL (in Ray/sphere.todo.cpp) method to draw a sphere at the appropriate tesselation. For now, you can ignore the input glslProgram parameter.You may not use the gluSphere function from the GLU library to assist you with this. Instead, you will have to explicitly generate the primitive (triangles/polygons) and render them yourself.
(2) Impelement the Ray::Material::drawOpenGL (in Ray/scene.todo.cpp) method to draw the material properties. For now, you can ignore the input glslProgram parameter.
(3) To draw the light sources, implement:
Ray::DirectionalLight::drawOpenGL (in Ray/directionalLight.todo.cpp);
Ray::PointLight::drawOpenGL (in Ray/pointLight.todo.cpp); and
Ray::SpotLight::drawOpenGL (in Ray/spotLight.todo.cpp)
The input index parameter specifies which of the OpenGL lights you are using and should be used for specifying the light parameters in the RayLight::drawOpenGL method: glLightfv(GL_LIGHT0+index, );
glEnable(GL_LIGHT0+index); For now, you can ignore the input glslProgram parameter.
(2) Modify the implementation of Ray::AffineShape::drawOpenGL (in Ray/shapeList.todo.cpp) to take into account the local transformation returned by the call: Ray::AffineShape::getMatrix. You can do this by pushing the appropriate matrix onto the stack prior to rendering and then popping it off after you are done. For now, you can ignore the input glslProgram parameter.
(3) Implement triangle texture mapping. To do this you will have to:
Modify the implementation of Ray::Triangle::drawOpenGL (in Ray/triangle.todo.cpp) to specify the texture coordinates prior to specifying the vertex positions.
Modify the implementation of Ray::Material::drawOpenGL (in Ray/scene.todo.cpp) method to enable and bind the texture if it is present.
Modify the implementation of Ray::Texture::initOpenGL (in Ray/scene.todo.cpp) method to generate the texture handle.
(1) Implement the Ray::Box::drawOpenGL (in Ray/box.todo.cpp) method to draw a box. For now, you can ignore the input glslProgram parameter.
(1) Implement the Ray::Cylinder::drawOpenGL (in Ray/cylinder.todo.cpp) method to draw a cylinder with bottom and top caps at the appropriate tesselation. For now, you can ignore the input glslProgram parameter.You may not use the gluCylinder and gluDisk functions from the GLU library to assist you with this. Instead, you will have to explicitly generate the primitives (triangles/polygons) and render them yourself.
(1) Implement the Ray::Cone::drawOpenGL (in Ray/cone.todo.cpp) method to draw a cone capped off at the bottom at the appropriate tesselation. For now, you can ignore the input glslProgram parameter.You may not use the gluCylinder and gluDisk functions from the GLU library to assist you with this. Instead, you will have to explicitly generate the primitives (triangles/polygons) and render them yourself.
(1) Implement the Ray::Torus::drawOpenGL (in Ray/torus.todo.cpp) method to draw a torus. at the appropriate tesselation. For now, you can ignore the input glslProgram parameter.
(1) Implement mouse control to facilitate translating the camera about the scene. To do this you will have to modify:
Ray::Camera::moveForward (in Ray/camera.todo.cpp) to implement a translation by a distance of dist along the forward direction.
Ray::Camera::moveRight (in Ray/camera.todo.cpp) to implement a translation by a distance of dist along the right direction.
Ray::Camera::moveUp (in Ray/camera.todo.cpp) to implement a translation by a distance of dist along the up direction.
(2) Implement mouse control to facilitate rotating around the scene scene. You should implement a crystal-ball system in which dragging the left mouse button rotates the viewer around the model, rotating either about the up-direction or the right-direction. To do this you will have to modify:
Ray::Camera::rotateUp (in Ray/camera.todo.cpp) to implement a rotation of angle degrees, around the up-axis, about the point center.
Ray::Camera::rotateRight (in Ray/camera.todo.cpp) to implement a rotation of angle degrees, around the right-axis, about the point center.
(2) Implement full scene anti-aliasing using the accumulation buffer. Hint: See the OpenGL Programming Guide for information about jittering.
Generate a .ray file describing a room scene with:
(1) Four walls, a floor and ceiling.
(3) A table, several chairs, etc. You may choose more interesting furnishings.
(1) At least one transparent surface, perhaps the table top.
(1) At least three texture mapped surfaces, each with a different texture.
(1) At least three point or spot light sources.
(2) A Luxo Jr. style lamp with keyboard and/or mouse controls for manipulating the joints of the lamp interactively while the spot light representing the bulb moves accordingly. Hint: see the robotic arm example in the OpenGL Programming Guide.
(2) A mirror. Hint: Reflect the world about the mirror and render it again through a stencil buffer.
(2) Shadows on at least one surface (such as the floor or table). Hint: See the OpenGL Programming Guide for the transformation which renders objects onto a plane.
(2) An object that responds to user mouse clicks (such as a light switch which turns on/off a light when clicked on by the user).
Support efficient rendering using vertex buffer objects. For this you will need to generate (bind, and set) the buffer objects in Ray::Shape::initOpenGL and draw the buffer objects in Ray::Shape::drawOpenGL.
(2) To implement the Ray::TriangleList::initOpenGL you should make use of Ray::Shape::addTrianglesOpenGL which accumulates the triangles from the child Ray::Shapes.
(1) Implement vertex buffer objects for Ray::Sphere.
(1) Implement vertex buffer objects for Ray::Cylinder.
(1) Implement vertex buffer objects for Ray::Cone.
(1) Implement vertex buffer objects for Ray::Torus.
OpenGL Shading Language (See the specification for more details.)
(2) Write vertex and fragment shaders that implement the traditional fixed pipeline with Phong Shading. (You can assume all lights are directional.)
(2) Adapt your Phong shader to support bump mapping.
(2) Modify the OpenGL renderer to allow the user to ray-trace the scene from the same perspective as the RayCamera.
(?) Impress us with something we hadnt considered
The assignment will be graded out of 30 points. In addition to implementing these features, there are several other ways to get more points:
(1) Submitting one or more images for the art contest.
(1) Submitting one or more .ray files for the art contest.
(1) Submitting one or more shader files for the art contest. You may consult online resources (make sure to do reference) but the shaders must be your own creation.
(2) Winning the regular art contest,
(2) Winning the .ray file art contest,
(2) Winning the shider file art contest.
It is possible to get more than 30 points. However, after 30 points, each point is divided by 2, and after 32 points, each point is divided by 4. If your raw score is 29, your final score will be 29. If the raw score is 33, youll get 31.25. For a raw score of 36, youll get 32.

What to Submit
Submission intstructions are specified here.
Please include the following in your submission:
the complete source code (with Makefile if compiling under Linux);
any .ray files you created.
images for the art contest
a writeup.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] graph OpenGL Computer Graphics, Fall 2018
$25