1 / 36

Computer Graphics

Computer Graphics. Lecture 9 Antialiasing, Texture Mapping. Today. Texture mapping Common texture coordinates mapping Texture coordinates Antialiasing Antialiasing-textures. 2. Texture Mapping : Why needed?. We don't want to represent all this detail with colour / geometry.

nita
Download Presentation

Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Lecture 9 Antialiasing, Texture Mapping

  2. Today • Texture mapping • Common texture coordinates mapping • Texture coordinates • Antialiasing • Antialiasing-textures 2

  3. Texture Mapping : Why needed? • We don't want to represent all this detail with colour / geometry

  4. Texture mapping. • Method of improving surface appearance by adding details on surface. • Done at the rasterization stage 4

  5. Photo-textures

  6. Interpolating the uv coordinates u1 v1 Again, we use baricentric Coordinates u= α u1 + β u2 + γ u3 v = α v1 + β v2 + γ v3 Or scan conversion u3 v3 u2 v2 u1 v1 u2 v2

  7. What will the textured triangle look like?

  8. Interpolation - What Goes Wrong? • Linear interpolation in screen space: texture source what we get| what we want

  9. Why does it happen? • Uniform steps on the image plane does not correspond to uniform steps along the edge

  10. How do we deal with it? • Use hyperbolic interpolation • (u,v) cannot be linearly interpolated, but 1/w and (u/w, v/w) can • w is the last component after the canonical view transformation • A w is computed for every 3D point

  11. Texture Mapping Examples • Linear interpolation vs. Hyperbolic interpolation • Two triangles per square

  12. In what case hyperbolic interpolation is essential? 1. ? 2. ?

  13. Common Texture Coordinate Mappings • Orthogonal • Cylindrical • Spherical

  14. Texture Mapping & Illumination Texture mapping can be used to alter some or allof the constants in the illumination equation: – pixel color, diffuse color

  15. Today • Texture mapping • Common texture coordinates mapping • Texture coordinates • Antialiasing • Antialiasing textures 15

  16. Anti-aliasing • Aliasing: distortion artifacts produced when representing a high-resolution signal at a lower resolution. • Anti-aliasing : techniques to remove aliasing Aliased polygons (jagged edges)‏ Anti-aliased polygons 16

  17. Nyquist Limit • The signal frequency (fsignal) should be no greater than half the sample frequency (fsample) • fsignal < 0.5 fsample • In the top, fsignal = 0.8 fsample -> cannot reconstruct the original signal • In the bottom fsignal =0.5 fsample -> the original signal can be reconstructed by slightly increasing the sampling rate

  18. Screen-based Anti-aliasing • Each pixel is subdivided (sub-sampled) into n regions, and each sub-pixel has a color; • Compute the average color value 18

  19. Accumulation Buffer (A-Buffer)‏ • Use a buffer that has the same resolution as the original image • To obtain a 2x2 sampling of a scene, 4 images are made by shifting the buffer horizontally/vertically for half a pixel • The results are accumulated and the final results are obtained by averaging • Various sampling schemes are available Pixel center Subsampled point

  20. Different Sampling Schemes

  21. Accumulation Buffer (A-Buffer)‏ • The lighting computation is usually done only once per vertex • Not doing the lighting computation at each sample point • The A-buffer’s focus is on the edge anti-aliasing • Also useful for rendering transparent objects, motion blur (will be covered later in the course) Edges

  22. Stochastic Sampling • A scene can be produced of objects that are arbitrarily small • A regular pattern of sampling will always exhibit some sort of aliasing • By irregular sampling, the higher frequencies appear in the image as noise rather than aliases • Humans are more sensitive to aliases than noise

  23. Stochastic Sampling • One approach to solve this is to randomly sample over the pixels • Jittering : subdivide into n regions of equal size and randomly sample inside each region • Compute the colour at the sample and average • Can precompute a table and recycle it or simply jitter on the fly

  24. Comparison

  25. Today • Texture mapping • Common texture coordinates mapping • Texture coordinates • Antialiasing • Antialiasing textures 26

  26. Aliasing of textures Happens when the camera is zoomed too much into the textured surface (magnification)‏ Several texels (pixels of the texture) covering a pixel’s cell (minification)‏ 27

  27. Texture Magnification • Zooming too much into a surface with a texture • One texel covering many pixels 28

  28. Bilinear Interpolation • Mapping the pixel centre to the uv coordinates • Computing the pixel colour by interpolating the surrounding texel values 29

  29. Bilinear Interpolation - 2 • For (pu, pv), compute its (u,v) coordinates by barycentric coordinates • u = pu – (int)pu, v = pv - (int)pv • xl= pu, xr = pu +1, yb= pv, yt= pv +1, • (pu, pv) : the pixel centre mapped into the texture space • b(pu,pv) : the colour at point pu, pv • t(x,y) : the texel colour at (x,y) • u = pu – (int)pu, v = pv - (int)pv

  30. Texture MinificationWhich texture will cause more aliasing when mapped onto the floor?

  31. Texture Minification • Many texels covering a pixel’s cell • Results in aliasing (remember Nyquist limit)‏ • The artifacts are even more noticeable when the surface moves • Solution • Mipmapping 32

  32. MIP map Multum In Parvo = Many things in a small place Produce a texture of multiple resolutions Switch the resolution according to the number of texels in one pixel Select a level that the ratio of the texture and the pixel is 1:1 33

  33. Selecting the resolution in Mipmap Map the pixel corners to the texture space Find the resolution that roughly covers the mapped quadrilateral Apply a bilinear interpolation in that resolution, Or find the two surrounding resolutions and apply a trilinear interpolation (also along the resolution axis)‏ 34

  34. Texture Minification • Multiple textures in a single pixel • Solution: • Nearest neighbour Bilinear blending Mipmapping 35

  35. Readings • Chapter 5.1-2 of Real-Time Rendering Second edition • http://books.google.co.uk/books?id=mOKEfBTw4x0C&printsec=frontcover&source=gbs_v2_summary_r&cad=0#v=onepage&q=&f=false • “Hyperbolic Interpolation” IEEE Computer Graphics and Applications, vol12, no.4, 89-94, 1992

More Related