Illumination Model & Surface

Download Report

Transcript Illumination Model & Surface

Illumination Model & Surface-rendering Method 2001.07.25

박 경 와

Contents   ILLUMINATION MODELS – – Ambient light, Diffuse reflection, Specular reflection Illumination in the Phong model POLYGON-RENDERING METHODS – Flat shading – – – – Gouraud shading Phong shading Comparision each methods Ray Tracing   Basic Algorithm Methods for getting better quality

BASIC ILLUMINATION MODELS

Ambient Light  Color does not depend on the position, only on the object I=IaKa ( Ia : ambient light intensity, Ka: ambient reflection coefficient)  Very Crude Model – – Object shape is in invisible But user nevertheless to hide other models artifacts

 Example Ambient Light Increasing Ka

Diffuse Reflection    Light from the light source is sent in every direction Object aspect independent from viewer position Only depends on relative position of light source I = Ip Kd cos Ø (Ip : point light source intensity Kd : Diffuse reflection coeffcient)

 Example Diffuse Reflection Increasing Kd ( Ka=0)

Diffuse + Ambient Increasing Kd

Specular Reflection   Light reaching the object is reflected in the direction having the same angle With point light source, effect is visible only at the one point on the surface  Useful for indirect illumination (reflection and shadows)

Specular Reflection   In the Phong model – Imperfect specular reflector I = IpK s (cosα) n α : angle between reflection and view point Figure. Left and right Imperfect Specular reflector

Phong Model    Treats point light sources only Models three types of reflected light – – Ambient + diffuse + imperfect specular reflector I = IaKa + Ip {Kdcosθ + Ks(cosα) n } No physical meaning model

Phong Model Increasing n

POLYGON-RENDERING METHODS

Constant-Intensity Shading  Flat Shading – – A fast and simple method Assign all pixels inside each polygon same color N2 N3 N1 N4 V Figure.

The normal vector at vertex V calculated as the average of the surface normals for each polygon sharing that vertex

Constant-Intensity Shading Example 1) Image with flat shading

Gouraud Shading    Take the colors at the vertices Interpolate these colors across the scan lines across the edges and Typically linear interpolation RGB 1 J K Scan line Interpolated colors RGB 3 RGB 2

Gouraud Shading Example 2) Image with Gouraud shading and specular highlights.

Phong Shading   Take the normals at the vertices Interpolate these normals Across the scan lines across the edges and normal 1 Interpolated nomals J K Scan line normal 3 normal 2

Phong Shading Example 3) Image with Phong shading and specular highlights .

Comparision   Flat shading – The simplest shading method Difference of two shading models – Phong shading is more accurate way of shading a polygon since the illumination model is applied to every point – More computationally intensive than the Gouraud  Illumination model is applied more often  Interpolated normals need to be normalized

Comparision a) Flat shading b) Gouraud shading c) Phong shading

RAY TRACING METHOD

Ray Tracing    One of the shading method To create several kinds of effects – Very difficult or even impossible to do with other methods Include three items – – – Reflection Transparency Shadow

Basic Ray-Tracing Algorithm  For each pixel ray – – Test each surface if it is intersected Intersected   Calculated the distance from the pixel to the surface intersection point The smallest value is visible surface for that pixel – – Reflection ray   Secondary ray Along specular path Transparent  Send a ray through the surface in the refraction direction

Figure. Ray Tracing

Basic Ray-Tracing Algorithm  Each secondary ray (reflection or refraction ray) – – Repeated the same procedure   Objects are tested for intersection The nearest surface along secondary ray path is used to recursively production the next generation of reflection and refraction path Ray tracing tree  Each successively intersected surface is added to a binary ray tracing tree

Figure. Ray Tracing

Ray-Tracing Tree     Left branch  Reflection Right branch  Transmission Terminated – – Reach the preset maximum Strike a light source Pixel intensity – – – Sum of intensities at root node Start at terminal node Background intensity  If tree is empty

Figure. Ray Trace and Ray-Tracing tree

Reducing Object Intersection Calculation    Ray surface intersection calculation – – 95 percent of the processing time in a ray tracer Spent most of processing time checking objects that are not visible along the ray path Enclose groups of adjacent objects within a bounding volume Check larger boundary volume and ,if necessary, smaller boundary volume; and so on.

Space-Subdivision Method     The other way to reduce intersection calculation Enclose a scene within a cube Uniform subdivision – (a) – Adaptive subdivision – (b) – Subdivided the cube into eight equal-size octants at each step Only subdivided cube containing objects

Anti-aliased Ray Tracing  Two basic techniques – Supersampling  The pixel is treated as a finite square area instead of a single point – Adaptive sampling   Uses unevenly spaced rays in some reason of the pixel area Ex. More rays can be used near object edges to obtains a better estimate of the pixel intensities

I

I E

Intensity Function 

K A I AL

 

i

(

K D

(

N

L i

)

I i

K S

(

V

R i

)

n I i

) • I E : Emitted Intensity  K A , K D , K s : Ambient /Diffuse /Specular reflection coefficient  I AL : Ambient-light Intensity  N : Unit normal vector  L i : Unit direction vector to the I-th point light source from a position on the surface  I i : the intensity of the I-th point light source  V : Unit viewing direction vector  R : Specular-reflection direction vector P14 P16