CG Class 7, Wed 2018-09-19

1   Old iclicker questions

ECSE-4750, Fall 2018

* Thu 2018-09-13

1.  What is your major?
A. CSYS
B. ELEC
C. CSCI
D. GSAS
E. Other


2. What is your class?
A. 2019
B. 2020
C. 2021
D. Grad
E. Other

3. What is the correct order of the graphics pipeline?
A. vertex-shader  fragment-shader rasterizer primitive-assembly
B. fragment-shader rasterizer primitive-assembly vertex-shader
C. rasterizer primitive-assembly vertex-shader  fragment-shader
D. primitive-assembly vertex-shader  fragment-shader rasterizer
E. vertex-shader primitive-assembly  rasterizer   fragment-shader

4. If you wanted to change all the vertex positions by multiplying each x-coordinate by the same vertex's y-coordinate, the best place to do it is:
A. with a javascript function
B. in the vertex shader
C. in the fragment shader
D. in the html file
E. it can't be done.

2. Why does WebGL have the triangle-strip object type, in addition to the triangle type?
A. It leads to smaller, faster, graphics objects.
B. It leads to bigger, faster, graphics objects.
C. It's not possible to split some complicated polygons into lots of simple
triangles, but you can split them into triangle-strips.
D. The standards writers were being paid by the word.


3. What is the physical principle underlying LCD?
A. Fire an energetic electron at a rare earth atom and a photon of light is emitted.
B. Plowing your family farm as a kid can suggest an way to invent electronic television.
C. A solution of corkscrew shaped molecules can rotate polarized light.
D. Putting your finger close to a capacitor can change its capacitance.
E. If two coils of wire are close, then an alternating current in one can induce a current in the other.

4. Standards
A. allow programmers to move between projects
B. allow different types of hardward to be substituted in.
C.  .....             operating systems ......
D. allow vendors to lock in customers.
E. can prevent the latest HW from being used to its fullest.


* Mon 2018-09-17

1. Color printing on a sheet of paper exemplifies

A. additive color
B. subtractive color
C. multiplicative color
D. divisive color
E. exponential color

2. Red is a primary color of which color space?

A. additive color
B. subtractive color
C. multiplicative color
D. divisive color
E. exponential color

3. Major components of the WebGl model as discussed in class are:

A. Objects, viewer, light sources, planets, material attributes.
B. Still cameras, video cameras, objects, light sources.
C. Objects, viewer, light sources, material attributes.
D. Colored objects, black and white objects, white lights, colored lights
E. Flat objects, curved objects, near lights, distant lights.

4. If you want your javascript program to send a color for each

vertex to the vertex shader, what type of variable would the
color be?

A. uniform
B. varying
C. attribute
D. dynamic
E. static

5. When one neuron in your retina receives a lot of light, that causes the neighboring neuron to

A. be more likely to fire
B. be less likely to fire
C. be unaffected by this neuron.

6. In the graphics pipeline, the step after rasterizing is the

A. vertex shader
B. primitive assembler
C. fragment shader
D. tesselation shader
E. javascript callback

7. The spectral wavelength of pure purple is about

A. 400 nm
B. 500 nm
C. 600 nm
D. 700 nm
E. There is no wavelength for pure purple.

8. What is your favorite platform/OS?

A. Windows
B. Linux
C. Mac
D. Android
E. Other

9.  The carpet is an example of

A. diffuse reflection
B. specular reflection
C. environment mapping
D. bump mapping
E. how to save money

10. Bump mapping is

A. more realistic than actually 3D modeling each bump
B. faster than actually 3D modeling each bump
C. both
D. neither
E. unrelated to modeling bumps; the name is coincidental.

2   Today's iclicker questions

* Wed 2018-09-19


1. How do you draw a pentagon in WebGL?

A. Split it into triangles.
B. Split it into triangles if it is concave, otherwise draw it directly.
C. Split it into triangles if it is convex, otherwise draw it directly.
D. Draw it directly.
E. Split it into hexagons.






2. In the WebGL pipeline, the Primitive Assembler does what?

A. fits together pieces of ancient Sumerian pottery.
B. rotates vertices as their coordinate systems change.
C. creates lines and polygons from vertices.
D. finds the pixels for each polygon.
E. reports whether the keyboard and mouse are plugged in correctly.





3. To draw into only part of the graphics window you would call:

A. gl.drawpart
B. gl_Position
C. gl.viewport
D. gl.window
E. There's no builtin routine; you have to scale your graphics
    yourself to achieve this.



4.  What buffer is used by WebGl to do hidden surface removal?

A. Closest object buffer
B. Color buffer
C. Depth or Z buffer
D. Hidden-surface buffer
E. Ray-trace buffer





5. If you do not tell WebGL to do hidden surface removal, and two
   objects overlap the same pixel, then what color is that pixel?

A. WebGL throws an error.
B. the closer object
C. the farther object
D. the first object to be drawn there
E. the last object to be drawn there






6.  gasket2 has this code:   var points=[ ]; ... points.push(a,b,c);
  What does push do here?

A. Appends new entries to the end of points.
B. Inserts new entries at the start of points.
C. Overwrites the first entries of points.
D. Overwrites the last entries of points.
E. Throws an error because we didn't specify a size for points.



7. Why would you want to send a variable to a vertex shader that has the same value for every vertex?

A. the vertex's coordinates
B. the vertex's color
C. the object's global orientation
D. the location of the global light source
E. C and D.




8. How would you send that variable to the vertex shader?

A. as a varying variable.
B. as a uniform variable.
C. in another array similar to the vertex array.
D. with a bindBuffer call.
E. with a bufferData call.



9. You call gl.BufferSubData to do what?

A. to add or replace part of the buffer in the GPU.
B. to define a submarine object.
C. to subtract some data in the buffer.
D. to tell the GPU to look for a pattern and substitute any occurrences,
E. to tell the GPU to use a subroutine instead of the main program.

4   Picking

The user selects an object on the display with the mouse. How can we tell which object was selected? This is a little tricky.

E.g., It's not enough to know what line of code was executed to draw that pixel (and even determining that isn't trivial). That line may be in a loop in a subroutine called from several places. We want to know, sort of, the whole current state of the program. Also, if that pixel was drawn several times, we want to know about only the last time that that pixel changed.

Imagine that the image shows cars in the north lot. You select a pixel that's part of the image of a wheel nut. However there are many wheel nuts in the image, perhaps all drawn with the same subroutine. You might want to know that you selected the 4th wheel nut on the right front wheel of the 2nd car on the left of the 3rd row from the front.

There are various messy methods, which are all now deprecated. The new official way is to use the color buffer to code the objects.

  1. Decide what granularity you want for the selection. E.g, in the north lot, you may not care about specific wheel nuts, but just about wheels. You want to know that you selected the right front wheel of the 2nd car on the left of the 3rd row from the front.
  2. Assign each wheel in the lot a different id number.
  3. When drawing the scene, use each wheel's id number for its color.
  4. Look at the contents of the color buffer pixel to know what you picked.
  5. Perhaps really store this info in a 2nd buffer parallel to the color buffer, so the image will look better.

6   Text chapter 3 programs

We'll continue the programs with triangle, cad1, and cad2.

  1. Textbook site.
  2. My local web copy .
  3. There's another copy on RCS at /afs/rpi.edu/home/56/frankwr/public_html/ECSE-4750/Angel/7E/03
  4. which is also visible on the web.

7   SIGGRAPH 2017 videos

SIGGRAPH is the world's leading CG conference. I'll show various videos from it.

  1. BendSketch: Modeling Freeform Surfaces Through 2D Sketching.

    My local copies (MP4 and WEBM) are here.

8   3D rotation

  1. Now we're starting a module on 3D rotations.
  2. My note on 3D rotation.
    1. All rigid transformations in 3D that don't move the origin have a line of fixed points, i.e., an axis, that they rotate around.
    2. deriving the vector formula for a rotation given the axis and angle
    3. computing the matrix from a rotation axis and angle
    4. testing whether a matrix is a rotation
    5. if it is, then finding the axis and angle.

9   Euler and angles and Gimbal lock

  1. http://www.youtube.com/watch?v=rrUCBOlJdt4&feature=related Gimble Lock - Explained.

    One problem with Euler angles is that multiple sets of Euler angles can degenerate to the same orientation. Conversely, making a small rotation from certain sets of Euler angles can require a jump in those angles. This is not just a math phenomenon; real gyroscopes experience it.

  2. http://en.wikipedia.org/wiki/Gimbal_lock

  3. What is Gimbal Lock and why does it occur? - an animator's view.