Intro to Textures
- This material is from Angel
- Textures are patterns
- Textures provide depth cues (size and location)
- And shape information
- The red book says "Glue" a picture onto a surface.
- Texture mapping is looking up colors for a pixel in a table.
- One, two and three dimensions
- One dimensional, a stipple for a line
- Two dimensional a surface covering
- Three dimensional, a block of wood, as you carve it
- Textures are often images
- But can be computed in the cpu
- Or even in the GPU on the fly
- Reflections and shadows have been handled in this manner.
- The basic unit of a texture is a texel or a texture element.
- Angel says that texture mapping involves four types of coordinates
- Object coordinates
- Screen coordinates
- Texture coordinates - usually mapped to object coordinates but used when filling a pixel in screen coordinates
- Parametric coordinates, for filling as we have seen before.
- Let us consider a two dimensional texture (an image or pattern) mapped onto a surface.
- Stored as an array of values in memory.
- But think of it as a continuous patter T(s,t)
- s and t are texture coordinates, 0 ≤ s ≤ 1, 0 ≤ t ≤ 1
- A texture map associates a texel with each point in a geometric object.
- One challenge is to find a mapping from a point in object space (x,y,z,w) to a point in the texture (s,t)
- This is usually done through a parametric coordinate mapping in terms of (u,v).
- For a pixel
- Find the portion of an object which maps to a pixel.
- Find the corresponding area of the texture that maps to that pixel.
- Modify the color of the texture at that point by the lighting equations
- Assign the new color to the frame buffer.
- Step 2 is difficult, and may result in a non-linear mapping (distortion)
- Textures are usually rectangles.
- These don't map the best to spheres or other curved surfaces.
- This also requires an inverse computation from pixel to object to texture coordinates.
- And in general, we are interested in mapping areas to areas, not points to points.
-
- The above image indicates some of the difficulties
- The preimage of a pixel on a surface might not be square
- And it might map to multiple "values" in the texture.
- Just selecting the "center of the pixel" value leads to serious antialiasing problems.
- But "averaging" the corners and center leads to other imaging problems, but is a better solution.
- In the end, a section of the texture is mapped to a section of a surface
-