Docsity

Homework 6 Problems for Introduction: Computer Graphics | CS 470, Assignments of Computer Graphics

Toggle sidebar
bg1
Homework 6 : Due Oct. 3, 2007
CS 470
September 26, 2007
1 Normals and Lighting
Approximate the normals of the parametric surface from homework 5 using finite differences. If
F(a, b) =
x(a, b)
y(a, b)
z(a, b)
, then use the approximations ∂F(a,b)
∂a ≈F(a+∆a,b)−F(a,b)
∆aand ∂F(a,b)
∂b ≈
F(a,b+∆b)−F(a,b)
∆b. A vector, N, perpendicular to the surface is given by N(a, b) = ∂F(a,b)
∂a ×∂F(a,b)
∂b .
The unit normal is given by n(a, b) = N(a,b)
||N(a,b)|| . Approximate the unit normals for the surface using
∆a= ∆b= 0.01.
1.1 Specification
Your will create an interactive 3D application with the following features:
•10% - Open a 512 ×512 window. The text in the titlebar should read ’Homework 6’. The
background color should be white, and depth testing should be enabled. For modes 2 and 3
enable GL_LIGHTING,GL_COLOR_MATERIAL. Render your name in the lower left hand corner.
Create a perspective viewing volume with field-of-view 90◦, near clip distance = 1, far clip
distance = 10 and aspect ratio the same as the window aspect ratio.
•20% - (Mode 1 - select with F1) Render the surface as green triangles and the normal vectors
as red lines with lighting disbled.
•30% - (Mode 2 - select with F2) Render the surface as blue triangles. Enable lighting and set
the normals using glNormal3f. Place a single light at coordinates (1,1,1,1).
•30% - (Mode 3 - select with F3) Render the surface as red triangles. Enable lighting and set
the normals using glNormal3f. A single light should orbit about the y-axis at 0.5 revolutions
per second. The radius of this orbital path is 1.0.
•10% - Documentation.
Extra credit:
•5% Draw the reflection of the parametric surface for a mirror in the x = -2 plane.
•5% Draw the shadow of the parametric surface (in black) on the y = -2 plane.
Either full or zero credit will be given for each of these specifications.
2 What to turn in
Submit all source code, a README file, and a working project file or Makefile which builds an
executable named ’hw6’ or ’hw6.exe’. Turn in a single tarred and gzipped, or zipped file by the start
of class on the due date. Electronic submissions should be made through ecampus.wvu.edu.
1

Partial preview of the text

Download Homework 6 Problems for Introduction: Computer Graphics | CS 470 and more Assignments Computer Graphics in PDF only on Docsity!

Homework 6 : Due Oct. 3, 2007

CS 470

September 26, 2007

1 Normals and Lighting

Approximate the normals of the parametric surface from homework 5 using finite differences. If

F(a, b) =

x(a, b) y(a, b) z(a, b)

, then use the approximations ∂F(a,b) ∂a ≈^

F(a+∆a,b)−F(a,b) ∆a and^

∂F(a,b) ∂b ≈ F(a,b+∆b)−F(a,b) ∆b. A vector,^ N, perpendicular to the surface is given by^ N(a, b) =^

∂F(a,b) ∂a ×^

∂F(a,b) ∂b. The unit normal is given by n(a, b) = (^) ||NN((a,ba,b))||. Approximate the unit normals for the surface using ∆a = ∆b = 0.01.

1.1 Specification

Your will create an interactive 3D application with the following features:

  • 10% - Open a 512 × 512 window. The text in the titlebar should read ’Homework 6’. The background color should be white, and depth testing should be enabled. For modes 2 and 3 enable GL_LIGHTING, GL_COLOR_MATERIAL. Render your name in the lower left hand corner. Create a perspective viewing volume with field-of-view 90◦, near clip distance = 1, far clip distance = 10 and aspect ratio the same as the window aspect ratio.
  • 20% - (Mode 1 - select with F1) Render the surface as green triangles and the normal vectors as red lines with lighting disbled.
  • 30% - (Mode 2 - select with F2) Render the surface as blue triangles. Enable lighting and set the normals using glNormal3f. Place a single light at coordinates (1,1,1,1).
  • 30% - (Mode 3 - select with F3) Render the surface as red triangles. Enable lighting and set the normals using glNormal3f. A single light should orbit about the y-axis at 0.5 revolutions per second. The radius of this orbital path is 1.0.
  • 10% - Documentation.

Extra credit:

  • 5% Draw the reflection of the parametric surface for a mirror in the x = -2 plane.
  • 5% Draw the shadow of the parametric surface (in black) on the y = -2 plane.

Either full or zero credit will be given for each of these specifications.

2 What to turn in

Submit all source code, a README file, and a working project file or Makefile which builds an executable named ’hw6’ or ’hw6.exe’. Turn in a single tarred and gzipped, or zipped file by the start of class on the due date. Electronic submissions should be made through ecampus.wvu.edu.