1 / 89

Surfaces & Illumination

Surfaces & Illumination. Refresh. 2D and 3D viewing and clipping. Hidden surface removal. Projections. Texture mapping. Rasterisation. Converts the vertex information output by the geometry pipeline into pixel information needed by the video display Anti-aliasing Z-buffer

claude
Télécharger la présentation

Surfaces & Illumination

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. Surfaces & Illumination

  2. Refresh • 2D and 3D viewing and clipping Hidden surface removal Projections Texture mapping

  3. Rasterisation • Converts the vertex information output by the geometry pipeline into pixel information needed by the video display • Anti-aliasing • Z-buffer • Transparent objects • Drawing lines • Texture mapping • Bump mapping

  4. Today • Texture mapping • Common texture coordinates mapping • Texture coordinates • Illumination

  5. Texture Mapping : Why needed?

  6. Texture mapping. • Method of improving surface appearance by adding details on surface.

  7. y v v u u x Texture mapping. • Image is ‘pasted’ onto a polygon. • Image is called a Texture map, it’s pixels are often referred as a Texels and have coordinates (u,v)‏ • Texture coordinates aredefined for each vertex of the polygon and interpolated across the polygon.

  8. Three Types of Mapping • Texture Mapping • Uses images to fill inside of polygons • Environment (reflection mapping) • Uses a picture of the environment for texture maps • Allows simulation of highly specular surfaces • Bump mapping • Emulates altering normal vectors during the rendering process

  9. Texture Mapping, environment map and bump map geometric model texture mapped Environment map Bump map

  10. Where does mapping take place? • Mapping techniques are implemented at the end of the rendering pipeline • Very efficient because few polygons make it past the clipper

  11. For each triangle in the model establish a corresponding region in the texture Photo-textures During rasterization interpolate the coordinate indices into the texturemap

  12. Is it simple? • Although the idea is simple---map an image to a surface---there are 3 or 4 coordinate systems involved 2D image 3D surface

  13. Coordinate Systems • Parametric coordinates • May be used to model curves and surfaces • Texture coordinates • Used to identify points in the image to be mapped • Object or World Coordinates • Conceptually, where the mapping takes place • Window Coordinates • Where the final image is really produced

  14. Texture Mapping parametric coordinates texture coordinates window coordinates world coordinates

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

  16. Mapping Functions • Basic problem is how to find the maps • Consider mapping from texture coordinates to a point a surface • Appear to need three functions x = x(s,t) y = y(s,t) z = z(s,t) • But we really want to go the other way (x,y,z) t s

  17. Backward Mapping • We really want to go backwards • Given a pixel, we want to know to which point on an object it corresponds • Given a point on an object, we want to know to which point in the texture it corresponds • Need a map of the form s = s(x,y,z) t = t(x,y,z) • Such functions are difficult to find in general

  18. Two-part mapping • One solution to the mapping problem is to first map the texture to a simple intermediate surface • Example: map to cylinder

  19. Cylindrical Mapping parametric cylinder x = r cos 2p u y = r sin 2pu z = v/h maps rectangle in u,v space to cylinder of radius r and height h in world coordinates s = u t = v maps from texture space

  20. Spherical Map We can use a parametric sphere x = r cos 2pu y = r sin 2pu cos 2pv z = r sin 2pu sin 2pv in a similar manner to the cylinder but have to decide where to put the distortion Spheres are used in environmental maps

  21. Second Mapping • Map from intermediate object to actual object • Normals from intermediate to actual • Normals from actual to intermediate • Vectors from center of intermediate actual intermediate

  22. Aliasing • Point sampling of the texture can lead to aliasing errors point samples in u,v (or x,y,z) space miss blue stripes point samples in texture space

  23. Surface Lighting Effects • The amount of incident light reflected by a surface depends on the type of material • Shiny materials reflect more of the incident light and dull surfaces absorb more of the incident light • For transparent surfaces some of the light is also transmitted through the material

  24. Why lightning? • Q: why? • A: nothing looks three dimensional!

  25. Light and surface interaction • (a): Specular surfaces appears shiny due to reflection of light. Mirrors are perfectly specular surfaces. • (b): Diffuse surfaces scatter reflected light in all directions. • (c): Translucent surfaces allow some of the light to penetrate through the surface. Light is refracted but reflection can also occur.

  26. Understanding light and reflections

  27. Point Light Sources • A point source is the simplest model we can use for a light source • We simply define: • The position of the light • The RGB values for the colour of the light • Light is emitted in all directions • Useful for small light sources

  28. Infinitely Distant Light Sources • A large light source, like the sun, can be modelled as a point light source • However, it will have very little directional effect • Radial intensity attenuation is not used

  29. Directional Light Sources & Spotlights • To turn a point light source into a spotlight we simply add a vector direction and an angular limit θl

  30. Directional Light Sources & Spotlights • Vlight is a unit vector • Vobj is a unit vector from the light source to an object • The dot-product of these two vectors gives us the angle between them • If this angle is inside the light’s angular limit then the object is within the spotlight

  31. Angular Intensity Attenuation • Light intensity decreasing as we move away from a light source, it also decreases angularly • A commonly used function for calculating angular attenuation is: • where the attenuation exponent al is assigned some positive value and angle is measured from the cone axis

  32. Light and surface interaction • Specularsurfaces appears shiny due to reflection of light. Mirrors are perfectly specular surfaces. • Diffuse surfaces scatter reflected light in all directions. • Translucent surfaces allow some of the light to penetrate through the surface. Light is refracted but reflection can also occur.

  33. Understanding light and reflections

  34. Point Light Sources • Light is emitted in all directions • Defined by: • The position of the light • The RGB values for the colour of the light • Useful for small light sources

  35. Infinitely Distant Light Sources • A large light source, like the sun, can be modelled as a point light source • No directional effect

  36. Directional Light Sources & Spotlights • To turn a point light source into a spotlight we simply add a vector direction and an angular limit θl

  37. Directional Light Sources & Spotlights • Vlight is a unit vector • Vobj is a unit vector from the light source to an object • The dot-product of these two vectors gives us the angle between them • If this angle is inside the light’s angular limit then the object is within the spotlight

  38. Angular Intensity Attenuation • Light intensity decreasing as we move away from a light source, it also decreases angularly • A commonly used function for calculating angular attenuation is: • where the attenuation exponent al is assigned some positive value and angle is measured from the cone axis

  39. Light reflection • The colors that we perceive are determined by the nature of the light reflected from an object White Light Colors Absorbed Green Light

  40. Surface Lighting Effects • The amount of incident light reflected by a surface depends on the type of material • Shiny materials reflect more of the incident light and dull surfaces absorb more of the incident light • For transparent surfaces some of the light is also transmitted through the material

  41. Diffuse Reflection • Surfaces that are rough or grainy tend to reflect light in all directions • This scattered light is called diffuse reflection

  42. Specular Reflection • Additionally to diffuse reflection some of the reflected light is concentrated into a highlight or bright spot • This is called specular reflection

  43. Ambient Light • A surface that is not exposed to direct light may still be lit up by reflections from other nearby objects – ambient light • The total reflected light from a surface is the sum of the contributions from light sources and reflected light

  44. Light example

  45. Example from the net Ambient Diffuse FinalImage Specular

  46. Example

  47. Illumination models: Preliminaries • n is the normal to the surface at the point p. • v is the direction to the viewer or COP. • l is the direction to the light source. • r is the direction of the perfect reflection of the light coming from direction l. • When we move the point p on the surface the vectors will change. • However, the normal n will only change if the surface is curved.

  48. Illumination models: Ambient and Lambertian Self-illuminating objects: Intrinsic intensity/reflection coefficient Background light: Ambient light Equally bright from all directions e.g. by matte surfaces: Lambertian surface with Ambient light Lambertian: light falling on it is scattered such that the apparent brightness of the surface to an observer is the same regardless of the observer's angle of view.

  49. Illumination models: Distance attenuation • Distance from light source to object reduce energy (light-source attenuation)

  50. Specular points and the Phong illumination model • Shiny surfaces have specular points. Color at specular points appear to be white. Phong illumination model useful for non-perfect reflectors: • αis the shininess parameter. How spread out is the high light around the perfect reflection vector r.

More Related