1 / 52

Shading (introduction to rendering)

Shading (introduction to rendering). Rendering. We know how to specify the geometry but how is the color calculated. Rendering. We know how to specify the geometry but how is the color calculated. Rendering. We know how to specify the geometry but how is the color calculated.

elisa
Download Presentation

Shading (introduction to rendering)

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. Shading(introduction to rendering)

  2. Rendering • We know how to specify the geometry but how is the color calculated

  3. Rendering • We know how to specify the geometry but how is the color calculated

  4. Rendering • We know how to specify the geometry but how is the color calculated

  5. Rendering: simulation of light transport • What makes up the final color of an object?

  6. Rendering: simulation of light transport • Diffuse scattering • matt surfaces • Specular reflection • shiny surfaces • highlight • Transparency • glass, water • penetrate the surface

  7. Rendering: simulation of light transport • How do we represent these observations in a mathematical framework

  8. Rendering: simulation of light transport • Real time rendering is generally not concerned with using a "correct" lighting equation, just a series of hacks to make things look right with as little computational effort as possible

  9. Illumination Models • Local • Direct illumination of surfaces by light sources • Global • all light/surface interactions for entire environment

  10. Globalillumination

  11. Globalillumination

  12. Local illumination • Input: • a 3D object • Material and color of the object • Position and structure of the light source • “Intensity” of the light source • Output: • Color and intensity of points of the given object A (modest) example of shading

  13. Collection of triangles or mesh Representing 3D Objects

  14. Dealing with color Three component intensity (red, green, blue) Luminance (intensity) of the source Red component of source red component of image Green component of source green component of image Blue component of source blue component of image Three similar but independent calculations We focus on one scalar value only

  15. Diffuse reflection • A perfect diffuse reflector (Lambertiansurface) scatters the light equally in all directions • Same appearance to all viewers • Depends on • Material of the surface • The position of the light

  16. Normals • What direction is the surface facing?

  17. CrossProduct • n.x=a.y*b.z-a.z*b.y • n.y=a.z*b.x-a.x*b.z • n.z=a.x*b.y-a.y*b.x

  18. Normals • A = V2 – V1 • B = V0 – V1 • N = A x B

  19. Normals • For each triangle we can define a normal for the face • For each vertex we an define a normal by interpolating normals of attached faces

  20. Diffuse: Two important vectors • To compute the intensity at P, we need • The unit normal vector N, • The unit vector L, from Pto the light N L θ P

  21. Diffuse: Two important vectors • To compute the intensity at P, we need • The unit normal vector N, • The unit vector L, from Pto the light N L θ P What is the diffuse color at P?

  22. Lambert’s cosine law • I : diffuse reflection at P • Id: intensity of the light from source • coefficient of diffuse reflection

  23. Coefficient of diffuse reflection • kd is usually determined by a trial and error approach • Examples: Component Gold Black plastic Silver Red 0.75 0.01 0.5 Green 0.6 0.01 0.5 Blue 0.22 0.01 0.5 kd=1 kd=0.75 kd=0.25 kd=0.5 kd=0.05

  24. Specular reflection • Diffusive reflection: no highlights, rough surface • Specular reflection: highlights, shiny and smooth surfaces • View dependent reflection

  25. Three important vectors • To compute the intensity at P, we need • The unit normal vector N, • The unit vector L, from Pto the light • The unit vector V, from P to the viewer N L V P

  26. Three important vectors • To compute the intensity at P, we need • The unit normal vector N, • The unit vector L, from Pto the light • The unit vector V, from P to the viewer N L V P What is the specular illumination at P?

  27. The shininess coefficient increasing n 0 90o -90o

  28. The Phong model for specular reflection • I : specular reflection at P • Id: intensity of the light from source • coefficient of specular reflection • n: controls shininess N N L R L R V P P

  29. Ambient light • “Physical rules” are too simplified • No indirect or global interaction of light • A hack to overcome the problem: use “ambient light”

  30. Ambient light specification • Not situated at any particular point • Spreads uniformly in all directions • Ia: intensity of ambient light in the environment • I: ambient light at a given point • : coefficient of ambient light reflection ka=1 ka=0 ka=0.5

  31. A combined model(The Phong local illumination model) • The final model = diffuse + specular + ambient

  32. How does it work in OpenGL

  33. Flat Shading • Individual faces are visualized • Same color for any point in the face

  34. Smooth Shading • Visualize the underlying surface • Each point on the face has its own color • Two techniques Gouraud and Phong shading

  35. Shading N

  36. Clarification • Phong reflection model or phong lighting refers to • Phong Shading refers to filling a triangle by interpolating the normal and calculating the color at each point

  37. Gouraud Shading • Specular highlight quality tied to detail of mesh • Specular highlights can even be missed

  38. Incorporating a distance term a,b,c are control parameters Empirical formula:

  39. Multiple light sources • The total reflection at p is the sum of all contributed intensities from all sources • OpenGL allows us to define several light sources

  40. OpenGL 2.0 (programmable) pipeline

  41. More advanced rendering

  42. More advanced rendering

  43. More advanced rendering

  44. More advanced rendering

  45. More advanced rendering

  46. More advanced rendering

More Related