CS 488 More Shading and Illumination
1
Luc RENAMBOT
CS 488 More Shading and Illumination Luc R ENAMBOT 1 Illumination - - PowerPoint PPT Presentation
CS 488 More Shading and Illumination Luc R ENAMBOT 1 Illumination No Lighting Ambient model Light sources Diffuse reflection Specular reflection Model: ambient + specular + diffuse Shading: flat, gouraud, phong, ...
1
Luc RENAMBOT
2
3
coordinate systems:
4
5
the four corners of the object we get the values for A, B,C, and D in these equations
from object space to texture space.
6
7
8
9
the edges to determine what happens if the texture is not 'big enough' to cover the object (that is if the pixel coordinates transformed into (u,w) coordinates falls outside the space occupied by the texture
itself over and over again on the polygon (useful for wood floors or brick walls or stucco walls) where a very small texture can be used to cover a very large space, or the texture can be told to clamp at the edges
10
11
12
can cast shadows on other objects.
polygonal surfaces are visible to the viewer. We can use similar algorithms to determine which surfaces are 'visible' to a light source - and are therefor lit
diffuse and specular components will depend on whether the polygon is visible to the light
13
14
totally transparent)
contributes nothing where they overlap
15
16
17
the z-buffer since the order that polygons are drawn does not affect screen-door transparency
the advantages of using a z-buffer is that the order in which the polygons are drawn became irrelevant. Here it is again necessary to draw the polygons back to front so that transparency can be correctly calculated
transparent ones
18
19
20
21
22
23
24
25
shade(object, ray, point, normal, depth)
{ color = ambient term for (each light) { sRay = ray from light to point if (dot product of normal and direction to light is positive) { compute how much light is blocked by opaque and transparent surfaces scale diffuse and specular terms before adding them to color } } if (depth < maxDepth) { if (object is reflective) { rRay = ray in reflection direction from point rColor = trace(rRay, depth+1) scale rColor by specular coefficient and add to color } if (object is transparent) { tRay = ray in refraction direction from point if (total internal reflection does not occur) { tColor = trace(tRay, depth+1) scale tColor by transmission coefficient and add to color } } } shade = color } 26
//-------------------------------------------------------------------
trace(ray, depth)
{ determine closest intersection of the ray with an object if (object is hit by ray) { compute normal at intersection return(shade(closest object hit, ray, intersection, normal, depth)) } else return(BACKGROUND_VALUE) } //-------------------------------------------------------------------
main()
{ for each scan line in the image for each pixel in the scan line { determine ray from center of projection through that pixel pixel = trace(ray, 1) } }
27
28
effects using much more realistic models than were used previously: lighting simulation
All of the light energy is accounted for
the ambient term simulated will now be specifically computed
29
30
31
energy that leaves j and arrives at i
32
33
34
j=1 FijBj = Ei
35
36
37
38
39
40
current topics in computer graphics - generally with students presenting papers from the most recent couple years of SIGGRAPH publications, and creating projects based around these ideas.
Virtual Reality
41