Lab 2: Reflection: BRDFs / Illumination Models

Assigned: 03/28

Due: 04/09


Introduction

This lab is designed to show you how shaders enable you to experience "life beyond Phong". Its goals are:

Shaders

In this lab, you will be implementing a number of standard (and non-standard) illumination models using shaders. All of these shaders were described in Monday's lecture on BRDFs. The shaders that you will write are:

As with the previous assignment, two ZIP archives have been provided for you:

What to Submit

As with the previous assignment, please place your solutions in the lab2results folder, as follows:

Create a ZIP archive of your lab2results folder by using the "Compress" entry of the right-click menu for the folder. Submit this ZIP archive on one of the Ubuntu systems with the command

try  wrc-grd  shading-2  lab2results.zip

Tasks

Part 1 - Basic

Both shading systems that we have looked at prefer the Phong-Blinn model (which makes use of the halfway vector) for basic illumination. In this part of the lab, you will be implementing the Phong model proper (i.e., using the R dot V definition) for specular reflection.

A: RenderMan®

To make things more interesting, you must implement the RenderMan version of this part without using the built-in diffuse and specular functions. You are free to use ambient if you wish. You can either use the illuminance construct directly, or write your own diffuse and specular functions (being sure to use different names for them, like myDiffuse and mySpecular). (The advantage of the latter approach is that you can reuse these function definitions in later parts of this lab by changing the function definitions.)

You should apply the shader to the scene found in rit.rib in the RenderMan folder of the ZIP linked above. Name the shader realPhong. On examining the RIB file, you will see the sphere making use of this shader. Feel free to provide different values to the shader parameters to see the effect on the rendered image.

By default, point light sources in RenderMan will attenuate based on distance. Although this will be useful to us when we get to the lighting lab, for now, if would be better if this was not the case. Thus, included in the RenderMan folder is a light source shader plainPointLight (found in the file plainPointLight.sl) which is referred to in the RIB file. Be sure to compile this file before attempting a render.

B: GLSL

For the GLSL part of the BASIC shader, you will implement Phong (proper) as a vertex shader. Use the code in the GLSL folder to start. Material properties and lights have been set up in this file. Your shader should be able to access this OpenGL state directly.


Part 2 - Intermediate

This shader will also focus on the Phong model.

A: RenderMan

Test out the illuminance construct in the shader that you created above by adding additional light sources. This will require modification of the RIB file rather than the shader code (assuming your shader is correct). Also, feel free to move the light source to assure that the specular highlight moves with it.

B: GLSL

For this part, implement the Phong (proper) model as a fragment shader. Recall that if you use a fragment shader, you'll need to write a vertex shader to pass thru the values that need to be interpolated. As with the RenderMan shader, try moving the light positions (from within OpenGL) and assure that the specular highlight moves accordingly.


Part 3 - Advanced

For part 3, you are to implement the Strauss model. This model is described in this paper and in the slides for the Reflection lecture. Don't let all the equations frighten you; they are just equations, and between the parameters to the shader and the constants defined in the paper you should find all the values needed for the variables in the equations. For GLSL, you are free to implement the shader as either a vertex shader or a fragment shader.


RenderMan is a registered trademark of Pixar.