{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Class6

# Class6 - Class 6 Lighting and Shading(HW4 CS580(Computer...

This preview shows pages 1–11. Sign up to view the full content.

Class 6. Lighting and Shading (HW4) Ulrich Neumann CS580 (Computer Graphics Rendering)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Review: the shading Eq C = (Ks Σ L [Ie (R E) s ] ) + (Kd Σ L [Ie (N L)]) + (Ka Ia) Note – V in figure is E (eye ray)
Examine the Vectors L is the direction to an infinitely far point source constant in whole scene and specified by the application E is constant and set by camera view direction known direction in image space (0,0,-1) know world space camera position and look-at point approximate far away camera with narrow FOV a camera close to the scene requires E computed for each model vertex or pixel N is specified at triangle vertices - given in model space R must be computed for each lighting calculation R = 2(N L)N - L (next slide) L, E, N, R must be transformed to the same space for shading Eq evaluation: model, world, or image space assume any of these spaces for now…

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Compute Reflection Ray R = 2(N L)N - L R N L θ θ 2(N L)N -L (N L)N
Vertex Normals and Face Normals What are the normals to the surface? Each polygonal face has a normal N = (b - a) x (c - b) Polygon mesh is only an approximation of true curved surfaces - can we do better? use the actual surface normals sample at vertices assume smooth variation over faces a b c N

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vertex Normals Vertex normals are duplicated at each shared vertex of adjacent-faces Two options when adjacent-faces share the same vertex position Same normal at adjacent-face vertex for smooth shading Different normal at adjacent-face vertex for sharp edges
Cases that come up in shading (1) You need to deal with these in the HW Sign of N L and N E Test the illumination and the viewing direction relative to the normal of a surface Both positive : compute lighting model Both negative : flip normal and compute lighting model on backside of surface Both different sign : light and eye on opposite sides of surface so that light contributes zero – skip it

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Cases that come up in shading (2) R E calculations must be clamped to zero to maintain [0, 1] bounded range R E may be negative for front or back surface illuminations Watch for color overflow from multiple lights Overflow causes black holes Occurs when converting float values >1.0 to 12-bit GzIntensity values written to the frame buffer R N L E
Shading Calculation Logistics Application specifies lights (Ie and Ia) and material properties (Ka, Kd, Ks, s) before we start any triangles Renderer uses these values until they are overwritten The geometry (vectors) and these parameters are all the elements needed to compute the shading equation However - we only know all this information at the model vertices where N is specified

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
All pixels need color All terms of shading eq are known (and fixed) everywhere on the triangle, except for Normals Norms are specified per-vertex – they can vary to approximate curvature of surface The shading mode flag describes how to compute the
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern