Skip to main content

CG Class 19, Mon 2019-10-28

1   No class next week

I'll be at https://sigspatial2019.sigspatial.org/ . Among other things, I'm part of a group producing a collection of Spatial Gems.

2   Why textures are hard to do

  1. ... although the idea is simple.
  2. You want to take each texel on each object, find which pixel it would draw on to, and draw it there.
  3. That's too expensive. Because of the projection, the projection of one texel is almost never the same size as a pixel.
    1. Sometimes several texels will project to the same pixel, so they have to be averaged together to get the pixel color.
    2. At other times, one texel will project over several pixels, so you want to blend pixel colors smoothly from one texel to the next texel.
    3. Most texels will be invisible in the final image. Even with today's computers, this wastes a lot of computing power.
  4. So, this is how it's really implemented.
    1. For each visible fragment, i.e., pixel, find which texel would draw there.
    2. This requires a backwards version of the graphics pipeline.
    3. The interesting surfaces are curved, where each parameter pair (u,v) uses a bicubic polynomial to generate an (x,y,z). You have to invert that.
    4. All this has to be computed at hundreds of millions of pixels per second.
    5. It usually utilizes special texture mapping hardware for speed.

4   Texture mapping programs

Programs.

  1. I'm not covering all the gruesome details of these programs, but just hitting highlights.

  2. particleDiffusion: buffer ping ponging of 50 particles initially placed randomly and then moving randomly with their previous positions diffused as a texture.

    It renders to a texture instead of to a color buffer. Then it uses the texture.

    There are better descriptions on the web. Search for 'webgl render texture'. I'll work with the textbook code. Jumping back and forth is confusing, partly because they might use different utility files.

    There are often better descriptions on the web than in the textbook. I've considered running a course only with web material. What do you think?

    https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API has good documentation.

  3. Several of the programs don't display on my laptop. They include bumpmap and render.

  4. Cubet: enabling and disabling the depth buffer and drawing translucent objects.

  5. pickcube etc. This prints the name of the name that you pick.

    1. This draws a label for each face into a separate buffer.
    2. Then it indexes into it with the coordinates of the mouse.

5   Week 10 slides

  1. 10_1 Reflection and Environment Maps.

  2. 10_2 Bump Maps.

    Perturb the surface normals to emulate small details (bumps).