



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
In this document, students are given instructions for implementing various shading techniques in a software graphics pipeline. The assignment involves creating vertex and fragment processors for smooth shading, texture-modulated shading, fragment shading, textured fragment shading, and reflection mapping. The document also provides information on the graphics pipeline stages and the provided framework code. Students are expected to use the blinn-phong lighting model and implement local lighting and texture interpolation.
Typology: Assignments
1 / 6
This page cannot be seen from the preview
Don't miss anything!




out: Saturday 18 October 2008 due: Tuesday 28 October 2008
In this assignment, you will implement several types of shading in a simple software graphics pipeline. In terms of the graphics pipeline stages we discussed in lecture, we are giving you the application and rasterizer stages of the pipeline, and your job is to implement the vertex and frag- ment processing stages to achieve several different kinds of shading. This is very much like the task you are faced with when using a modern programmable graphics processor such as the ones that power current high-end PC graphics boards.
As discussed in lecture, the graphics pipeline is a sequence of processing stages that efficiently transforms a set of 3D primitives into a shaded rendering from a particular camera. The major stages of the pipeline are:
For each of rendering methods detailed below, you will implement a vertex processor and a fragment processor as subclasses of the VertexProcessor and FragmentProcessor base classes. The vertex processor’s input is a vertex’s position, color, normal, and texture coordinates. It returns a processed Vertex to the pipeline. Each Vertex will contain a screen space vertex position and an attribute array containing its parameters. They are given to the rasterizer which produces fragments whose data is interpolated from the vertex attributes. The fragment processor takes as input a Fragment which contains an integer (x, y) pixel coordinate and an attribute array, and after doing the appropriate computations, it sets pixels in the FrameBuffer as appropriate.
The attribute arrays are the means of communication between the vertex and fragment programs, and the two stages need to agree on how many attributes there are and what they mean. When the user chooses the two programs, the framework enforces agreement on the number of attributes, but the semantics are up to you.
The pipeline contains three transformation matrices: the Modelview matrix, which is the product of the modelling and viewing matrices we discussed in lecture, the Projection matrix, and the Viewport matrix. You’ll use the Modelview matrix to transform the input triangle data in object space to eye-space coordinates. An important feature of the pipeline is that it only allows rotations and translations in the Modelview matrix. This means that you can transform normals using the same matrix you use to transform vectors, a nice convenience.
Our software graphics pipeline cannot match the performance of dedicated hardware; though for small scenes, like those in this assignment, it can acheive interactive performance. However, the time to render a frame is largely pixel bound meaning most of the time is spent in fragment process- ing. You should take care to implement your fragment programs as efficiently as possible. Make every statement count! In particular, your performance will be seriously compromised if you allo- cate objects in the fragment program or to use many calls to the Math library.
Implement vertex and fragment programs to provide the following kinds of shading with hidden surface removal and support for multiple light sources.
To control the camera in the “Orbit Camera” mode, click and drag in the window to rotate the model, and shift-click and drag to move the camera closer or farther away. In the “Flythrough” mode, click and drag to rotate the camera in place, and shift-click and hold to move forward. You can steer while moving forward by moving the mouse around.
Also included are several stub classes for the triangle and fragment shaders that you will need to implement for this assignment. We expect that each of the shading modes described above will be implemented by the following pairs of shading processors:
To get you started, we’ve provided ConstColorVP and TrivialColorFP as very basic shaders, so make sure you understand them. A good first step is probably to implement ColorZBufferFP and test it using ConstColorVP with the two-spheres scene.
Hand in in the usual way via CMS. Include a .zip file of the entire pipeline package tree. If you did extra credit, include any additional data files that are needed.