30
Illumination Model Illumination Model & & Surface-rendering Surface-rendering Method Method 2001.07.25 박 박 박

Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Embed Size (px)

Citation preview

Page 1: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Illumination Model Illumination Model & &

Surface-rendering Surface-rendering MethodMethod

2001.07.25박 경 와

Page 2: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

ContentsContents

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

Page 3: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

BASIC ILLUMINATION BASIC ILLUMINATION MODELSMODELS

Page 4: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Ambient LightAmbient 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

Page 5: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Ambient LightAmbient Light

Example

Increasing Ka

Page 6: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Diffuse ReflectionDiffuse 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)

Page 7: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Diffuse ReflectionDiffuse Reflection

Example

Increasing Kd ( Ka=0)

Page 8: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Diffuse + AmbientDiffuse + Ambient

Increasing Kd

Increasing ka

Page 9: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Specular ReflectionSpecular 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)

Page 10: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Specular ReflectionSpecular Reflection In the Phong model

– Imperfect specular reflector I = IpKs(cosα)n

α : angle between reflection and view point

Figure. Left and right

Imperfect Specular reflector

Page 11: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Phong ModelPhong 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

Page 12: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Phong ModelPhong Model

Increasing n

Ks

Page 13: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

POLYGON-RENDERINGPOLYGON-RENDERINGMETHODSMETHODS

Page 14: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Constant-Intensity Constant-Intensity ShadingShading

Flat Shading– A fast and simple method– Assign all pixels inside each polygon same color

VN4

N3N2

N1

Figure.

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

Page 15: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Constant-Intensity Constant-Intensity ShadingShading

Example 1)

Image with flat shading

Page 16: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Gouraud ShadingGouraud Shading Take the colors at the vertices Interpolate these colors across the edges and

across the scan lines Typically linear interpolation

RGB 1

RGB 2

RGB 3

J K Scan lineInterpolated

colors

Page 17: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Gouraud ShadingGouraud Shading

Example 2)

Image with Gouraud shading and specular highlights.

Page 18: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Phong ShadingPhong Shading Take the normals at the vertices Interpolate these normals across the edges and Acros

s the scan lines

normal 1

normal 2

normal 3

J K Scan lineInterpolated

nomals

Page 19: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Phong ShadingPhong Shading

Example 3)

Image with Phong shading and specular highlights.

Page 20: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Comparision 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

Page 21: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Comparision Comparision

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

Page 22: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

RAY TRACING METHODRAY TRACING METHOD

Page 23: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Ray TracingRay 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

Page 24: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

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

Basic Ray-Tracing Basic Ray-Tracing AlgorithmAlgorithm

Figure. Ray Tracing

Page 25: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

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

Basic Ray-Tracing Basic Ray-Tracing AlgorithmAlgorithm

Figure. Ray Tracing

Page 26: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

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

Ray-Tracing TreeRay-Tracing Tree

Figure. Ray Trace and Ray-Tracing tree

Page 27: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Reducing Object-Reducing Object-Intersection CalculationIntersection 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.

Page 28: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Space-Subdivision MethodSpace-Subdivision Method

The other way to reduce intersection calculation Enclose a scene within a cube Uniform subdivision – (a)

– Subdivided the cube into eight equal-size octants at each step

Adaptive subdivision – (b)– Only subdivided cube containing objects E

xample - a

Exam

ple - b

Page 29: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Anti-aliased Ray TracingAnti-aliased Ray Tracing Two basic techniques

– Supersampling The pixel is treated as a finite square area instead of a single p

oint

– 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

Page 30: Illumination Model & Surface-rendering Method 2001.07.25 박 경 와

Intensity FunctionIntensity Function

i in

iSiiDALAE IRVKILNKIKII ))()((

• IE : Emitted Intensity

KA, KD, Ks : Ambient /Diffuse /Specular reflection coefficient

IAL : Ambient-light Intensity

N : Unit normal vector

Li : Unit direction vector to the I-th point light source from a position on the surface

Ii : the intensity of the I-th point light source

V : Unit viewing direction vector

R : Specular-reflection direction vectorP14 P16