Graphics Illumination Model http kucg korea ac kr

  • Slides: 50
Download presentation
Graphics Illumination Model 고려대학교 컴퓨터 그래픽스 연구실 http: //kucg. korea. ac. kr Graphics Lab

Graphics Illumination Model 고려대학교 컴퓨터 그래픽스 연구실 http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Shading KUCG Compute the radiance for each object n Figure out which pixels to

Shading KUCG Compute the radiance for each object n Figure out which pixels to fill n Determine a color for each filled pixel n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Illumination Components KUCG Emission at light sources n Scattering at surfaces n Wireframe http:

Illumination Components KUCG Emission at light sources n Scattering at surfaces n Wireframe http: //kucg. korea. ac. kr Without Illumination With Illumination Graphics Lab @ Korea University

Light Source Model n KUCG Simple mathematical models Point light n Directional light n

Light Source Model n KUCG Simple mathematical models Point light n Directional light n Spot light n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Point Light Source n KUCG Omni-directional point source, ex) bulb Intensity (I) n Position

Point Light Source n KUCG Omni-directional point source, ex) bulb Intensity (I) n Position (px, py, pz) n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Directional Light Source n KUCG Point light source at infinity, infinity ex) sun Intensity

Directional Light Source n KUCG Point light source at infinity, infinity ex) sun Intensity (I) n Direction (dx, dy, dz) n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Spot Light Source n KUCG Point light source with direction, direction ex) Luxo Intensity

Spot Light Source n KUCG Point light source with direction, direction ex) Luxo Intensity (I), n Position (px, py, pz) n Direction (dx, dy, dz) n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Light Intensity Function KUCG n IE: emitted intensity for light sources n KA, KD,

Light Intensity Function KUCG n IE: emitted intensity for light sources n KA, KD, Ks n o Ambient / diffuse / specular reflection coefficient IAL: ambient light intensity n N: unit normal vector n L n o Unit direction vector to the point light source from a position on the surface IL: the intensity of the point light source n V: unit viewing direction vector n R: specular reflection vector n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Reflectance Model n KUCG Simple analytic model Diffuse reflection n Specular reflection n Emission

Reflectance Model n KUCG Simple analytic model Diffuse reflection n Specular reflection n Emission n Ambient n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Diffuse Reflection n KUCG Surface reflects equally in all directions n With equal intensity

Diffuse Reflection n KUCG Surface reflects equally in all directions n With equal intensity http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Diffuse Reflection n KUCG How much light is reflected? Depends on angle of incident

Diffuse Reflection n KUCG How much light is reflected? Depends on angle of incident light n d. L = d. A cos = N L n o Maximum at the head-on light ( = 0) N http: //kucg. korea. ac. kr L Graphics Lab @ Korea University

Specular Reflection n KUCG Strongest reflection near the mirror angle n Examples: mirrors, metals

Specular Reflection n KUCG Strongest reflection near the mirror angle n Examples: mirrors, metals http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Specular Reflection n KUCG How much light is reflected? n Depends on Angle of

Specular Reflection n KUCG How much light is reflected? n Depends on Angle of incident light o Angle to viewer o http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Specular Reflection n KUCG Phong model n {cos(a)}n = (V R)n o n: exponent

Specular Reflection n KUCG Phong model n {cos(a)}n = (V R)n o n: exponent Ks: Specular Reflectance Factor http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Effects of Exponent KUCG Ambient Exponent(n) http: //kucg. korea. ac. kr Graphics Lab @

Effects of Exponent KUCG Ambient Exponent(n) http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Emission n KUCG Light emitting directly from surfaces n ex) light source http: //kucg.

Emission n KUCG Light emitting directly from surfaces n ex) light source http: //kucg. korea. ac. kr Emission ≠ 0 Graphics Lab @ Korea University

Ambient Term n KUCG Compensated reflection of indirect illumination http: //kucg. korea. ac. kr

Ambient Term n KUCG Compensated reflection of indirect illumination http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Reflectance Model n KUCG Simple analytic model Diffuse reflection n Specular reflection n Emission

Reflectance Model n KUCG Simple analytic model Diffuse reflection n Specular reflection n Emission n Ambient n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Reflectance Model n KUCG Simple analytic model Diffuse reflection Affected by the position of

Reflectance Model n KUCG Simple analytic model Diffuse reflection Affected by the position of the light source n Specular reflection n Emission Not affected by the position of the light source n Ambient n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Ambient and Diffuse KUCG Ambient Diffuse http: //kucg. korea. ac. kr Graphics Lab @

Ambient and Diffuse KUCG Ambient Diffuse http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Surface Illumination Calculation n KUCG Single light source http: //kucg. korea. ac. kr Graphics

Surface Illumination Calculation n KUCG Single light source http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Surface Illumination Calculation n KUCG Multiple light sources Not Affected http: //kucg. korea. ac.

Surface Illumination Calculation n KUCG Multiple light sources Not Affected http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Shadows n KUCG Which light sources are blocked Cast ray towards each light source

Shadows n KUCG Which light sources are blocked Cast ray towards each light source Li n Si = 0 if ray is blocked, Si = 1 otherwise n Shadow Term http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Transparency n Alpha value n n KUCG How much light can be transmitted? Back

Transparency n Alpha value n n KUCG How much light can be transmitted? Back to front http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Polygon Shading n KUCG Spatial coherence n Illumination calculations for pixels covered by the

Polygon Shading n KUCG Spatial coherence n Illumination calculations for pixels covered by the same primitive http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Flat Shading KUCG Constant-intensity shading n OK for polyhedral objects n Not so good

Flat Shading KUCG Constant-intensity shading n OK for polyhedral objects n Not so good for ones with smooth surfaces n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Flat Shading Process n KUCG One illumination calculation per polygon n Assign all pixels

Flat Shading Process n KUCG One illumination calculation per polygon n Assign all pixels inside each polygon the same color Polygon Normal Vector http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Gouraud Shading n KUCG Intensity-interpolation scheme n Produces smoothly shaded polygonal mesh Piecewise linear

Gouraud Shading n KUCG Intensity-interpolation scheme n Produces smoothly shaded polygonal mesh Piecewise linear approximation o To capture subtle lighting effects o o Needs fine mesh Phong shading solves it <Flat Shading> http: //kucg. korea. ac. kr <Gouraud Shading> Graphics Lab @ Korea University

Gouraud Shading KUCG Polygonal mesh with the vertex normal vectors n Smooth shading over

Gouraud Shading KUCG Polygonal mesh with the vertex normal vectors n Smooth shading over adjacent polygons n Curved surfaces n Illumination highlights n Soft shadows n Mesh with Shared Normals at Vertices http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Gouraud Shading Process (1/2) n KUCG One lighting calculation per vertex n Assign pixels

Gouraud Shading Process (1/2) n KUCG One lighting calculation per vertex n Assign pixels inside polygon o By interpolating colors computed at vertices N 1 Viewer L 1 V 1 N 2 Light N 3 Polygon Vertex Normal Vector http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Gouraud Shading Process (2/2) n KUCG Bilinearly interpolate colors at vertices n Down and

Gouraud Shading Process (2/2) n KUCG Bilinearly interpolate colors at vertices n Down and across scan lines I 1 I I 2 http: //kucg. korea. ac. kr I 3 Graphics Lab @ Korea University

Vertex Normal Vector n KUCG Average of the surface normals n For each polygon

Vertex Normal Vector n KUCG Average of the surface normals n For each polygon sharing that vertex N 2 N 1 N 3 N 4 http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Phong Shading KUCG Normal-vector interpolation shading n Subtle illumination effects in polygon interiors n

Phong Shading KUCG Normal-vector interpolation shading n Subtle illumination effects in polygon interiors n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Phong Shading Process (1/2) n KUCG One lighting calculation per pixel n Approximate surface

Phong Shading Process (1/2) n KUCG One lighting calculation per pixel n Approximate surface normals for inside points N 1 Viewer L 1 V 1 N 2 Light N 3 Polygon http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Phong Shading Process (2/2) n KUCG Bilinearly interpolate surface normals at vertices n Down

Phong Shading Process (2/2) n KUCG Bilinearly interpolate surface normals at vertices n Down and across scan lines N 1 N 2 http: //kucg. korea. ac. kr N α β γ N 3 Graphics Lab @ Korea University

Various Shading Results http: //kucg. korea. ac. kr KUCG <Wireframe> <Flat> <Gouraud> <Phong> Graphics

Various Shading Results http: //kucg. korea. ac. kr KUCG <Wireframe> <Flat> <Gouraud> <Phong> Graphics Lab @ Korea University

Ray Casting & Tracing n KUCG Independent lighting calculation for every pixel http: //kucg.

Ray Casting & Tracing n KUCG Independent lighting calculation for every pixel http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Ray Casting & Tracing http: //kucg. korea. ac. kr KUCG Graphics Lab @ Korea

Ray Casting & Tracing http: //kucg. korea. ac. kr KUCG Graphics Lab @ Korea University

Ray Casting n KUCG Find surface intersection point Ray from eye to the screen

Ray Casting n KUCG Find surface intersection point Ray from eye to the screen pixel n No reflection or refraction n o n Direct illumination Visible surface detection n Shadow calculation http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Ray Tracing KUCG Recursive ray casting n Inter-object light reflection effects n Global (mutual)

Ray Tracing KUCG Recursive ray casting n Inter-object light reflection effects n Global (mutual) illumination n For global reflection and transmission n Highly realistic quality vs. computation time n Overview n Bounce (reflect) or refract the ray n Collecting its intensity n o At each reflection point http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Ray Tracing Example KUCG <Reflection and refraction ray paths through a scene for a

Ray Tracing Example KUCG <Reflection and refraction ray paths through a scene for a screen pixel> http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Ray Tracing Tree KUCG Left branch: reflection n Right branch: transmission (refraction) n Terminate

Ray Tracing Tree KUCG Left branch: reflection n Right branch: transmission (refraction) n Terminate when n Reaches the defined maximum depth n Strikes the light sources n n Accumulate the intensity n From the bottom to top <Ray Tracing Tree> http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Summary n KUCG Polygon shading Flat shading n Gouraud shading n Phong shading n

Summary n KUCG Polygon shading Flat shading n Gouraud shading n Phong shading n Supported by Open. GL Ray casting n Ray tracing n Recursive ray casting n Inter-object reflection (global illumination) n Highly realistic quality vs. computation time n n Radiosity http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Graphics For Implementation http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Graphics For Implementation http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Intensity Calculation KUCG For general object, IE = 0 n IAL ≠ IE n

Intensity Calculation KUCG For general object, IE = 0 n IAL ≠ IE n Intensity calculation for RGB channel (IR, IG, IB) n n KAR, KDR, KSR, KAG, KDG, KSG, KAB, KDB, KSB http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Shading Function Example n KUCG IE = 0, KA = 0. 2, KD =

Shading Function Example n KUCG IE = 0, KA = 0. 2, KD = 0. 4, KS = 0. 1, IAL = 0. 3, I 0 = 0. 8, n = 32 N 1 N 2 http: //kucg. korea. ac. kr N 3 Graphics Lab @ Korea University

Scan-line Shading Example KUCG N 1 P 1 2 1. 5 N 2 1

Scan-line Shading Example KUCG N 1 P 1 2 1. 5 N 2 1 1 P 2 http: //kucg. korea. ac. kr N 3 P 3 Graphics Lab @ Korea University

Flat Shading Example KUCG N 1 P 1 N N 2 P 2 http:

Flat Shading Example KUCG N 1 P 1 N N 2 P 2 http: //kucg. korea. ac. kr N 3 P 3 Graphics Lab @ Korea University

Gouraud Shading Example KUCG N 1 I 4=(I 1*1+I 2*2)/3 P 1 2 I

Gouraud Shading Example KUCG N 1 I 4=(I 1*1+I 2*2)/3 P 1 2 I 5=(I 1*1+I 3*1. 5)/2. 5 1. 5 N 2 1 1 P 2 I 2 http: //kucg. korea. ac. kr I=(I 4*1+I 5*2)/3 N 3 P 3 I 3 Graphics Lab @ Korea University

Phong Shading Example KUCG N 1 N 4=(N 1*1+N 2*2)/3 P 1 N 5=(N

Phong Shading Example KUCG N 1 N 4=(N 1*1+N 2*2)/3 P 1 N 5=(N 1*1+N 3*1. 5)/2. 5 2 1. 5 N 2 1 1 P 2 http: //kucg. korea. ac. kr N=(N 4*1+N 5*2)/3 N 3 P 3 Graphics Lab @ Korea University