2013-12-12

Practice Final Problem #8.

Originally Posted By: sunnyle
Names: Sunny Le and Gavin

Question 8: Give the steps OpenGL uses to do rational linear interpolation of a varying variable.
You can look at the slides 4 and 5 from Nov 27th if you want more details, the contents of the slides are summarized below to answer question 8.

1) For each vertex, the vertex shader calculates the clip coordinates and and varying variables by multiplying by PM. P is the projection matrix while M = E^-1 O.
2) Then OpenGL creates two internal variables V/Wn and 1/Wn for each vertex and varying variable.
3) For each vertex , division is done to find the normalized device coordinates ( Xn = Xc/Wc, Yn = Yc/Wc, and Zn = Zc/Wc) and then they are transformed into window coordinates using the viewport matrix.
4)The [Xw, Yw]^t coordinates are used to position the triangle on the screen.
5) For every interior pixel of the triangle, linear interpolation is used to find the interpolated values of Zw, V/Wn (for all varying variables) and 1/Wn.
6) For each pixel, the interpolated Zw value is used for z-buffering.
7) For each pixel and for all varying variables, division is done on the interpolated internal variables: V = (V/Wn)/(1/Wn).
8) V is then passed to the fragment shader.
'''Originally Posted By: sunnyle''' Names: Sunny Le and Gavin<br><br>Question 8: Give the steps OpenGL uses to do rational linear interpolation of a varying variable.<br>You can look at the slides 4 and 5 from Nov 27th if you want more details, the contents of the slides are summarized below to answer question 8.<br><br>1) For each vertex, the vertex shader calculates the clip coordinates and and varying variables by multiplying by PM. P is the projection matrix while M = E^-1 O.<br>2) Then OpenGL creates two internal variables V/Wn and 1/Wn for each vertex and varying variable.<br>3) For each vertex , division is done to find the normalized device coordinates ( Xn = Xc/Wc, Yn = Yc/Wc, and Zn = Zc/Wc) and then they are transformed into window coordinates using the viewport matrix.<br>4)The [Xw, Yw]^t coordinates are used to position the triangle on the screen.<br>5) For every interior pixel of the triangle, linear interpolation is used to find the interpolated values of Zw, V/Wn (for all varying variables) and 1/Wn.<br>6) For each pixel, the interpolated Zw value is used for z-buffering.<br>7) For each pixel and for all varying variables, division is done on the interpolated internal variables: V = (V/Wn)/(1/Wn).<br>8) V is then passed to the fragment shader.
X