Polygon Rendering - Introduction to Computer Graphics - Lecture Slides, Slides of Computer Graphics

In Introduction to Computer Graphics course we study the basic concept of the principle of computer architecture. In these lecture slides the key points are:Polygon Rendering, Shading Versus Lighting, Shading Models, Lighting Value, Normal Vector, Lighting Equation, Interior Pixel, Shading Models Compared, Constant Shading, Gouraud Shading, Flat Shading

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarasvan
sarasvan 🇮🇳

4.4

(20)

118 documents

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 19:
Polygon Rendering
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Polygon Rendering - Introduction to Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Lecture 19:

Polygon Rendering

Shading vs. Lighting

• How is Shading different from

Lighting?

• Lighting evaluates the lighting

equation at each point on the

surface of an object

• Shading is kind of a “hack” that

computes only lighting

equations on the vertices, and

interpolates the pixels in

between

Shading Models – Gouraud

  • We define a normal vector at each vertex
  • Lighting: Evaluate the lighting equation at

each vertex using the associated normal

vector

  • Shading: Each sample point’s color on the

polygon is interpolated from the color values

at the polygon’s vertices which were found in

the lighting step

Shading Models – Phong

  • Each vertex has an associated normal

vector

  • Lighting: Evaluate the lighting equation at

each vertex using the associated normal

vector

  • Shading: For every sample point on the

polygon we interpolate the normals at

vertices of the polygon and compute the

color using the lighting equation with the

interpolated normal at each interior pixel

Shading Models Compared

Flat or Faceted

Shading: constant

intensity over

each face

Constant Shading

Shading Models Compared

Gouraud Shading:

Linear Interpolation

of intensity across

triangles to

eliminate edge

discontinuity

Flat Shading

Shading Models Compared

Global Illumination:

Objects enhanced

using shadow,

texture, bump, and

reflection mapping

(see S20)

Phong Shading

Shading Models Explained (1/6:

Faceted)

  • Faceted Shading:
    • Single illumination value per polygon (GL_FLAT)
    • With many polygons approximating a curved

surface, this creates an undesirable faceted look.

  • Facets exaggerated by “Mach banding” effect

Shading Models Explained (3/6:

Gouraud cont.)

  • Step 1: Evaluate illumination at each vertex using lighting model
  • Step 2: Interpolate illumination along polygon edges (𝐼𝑎, 𝐼𝑏)
  • Step 3: Interpolate illumination along scan lines (𝐼𝑝)

April 15, 2013 (^13)

scan line

1 I

2 I

I 3

Ia Ib

Ip

y 1

ys

2 y

3

y

1 2

1 2 1 2

2 1 y y

y y I y y

y y I I

s s a

1 3

1 3 1 3

3 1 y y

y y I y y

y y I I

s s b

b a

p a b b a

b p p a x x

x x I x x

x x I I

  

 

Shading Models Explained (4/6:

Gouraud cont.)

  • Takes advantage of scan line algorithm for efficiency

∆𝐼 ∆𝑦

is constant along polygon edge,

∆𝐼 ∆𝑥

is constant along scan line

  • Gouraud vs. Faceted shading:

Shading Models Explained (6/6: Phong

Shading)

Gouraud Phong Gouraud Phong

http://en.wikipedia.org/wiki/Gourad_shading

 Phong Model: normal vector interpolation

 Interpolate N rather than I

 Always captures specular highlights, but computationally expensive

 At each pixel, N is recomputed and normalized (requires sq. root

operation)

 Then I is computed at each pixel (lighting model is more expensive

than interpolation algorithms)

 This is now implemented in hardware, very fast

 Looks much better than Gouraud, but still no global effects

Gouraud vs. Phong Shading

Advanced Techniques (Shadows 2/2)

  • Shadow Maps
    • Transform camera to each directional light source
      • Render the scene from the light source POV, keeping the same far clipping plane, update z-buffer only
      • Read the z-buffer back and apply as a texture (shadow map) to the scene projected from the light’s POV
      • Render the scene from the eye point. At each pixel, if distance from light is greater than in the shadow map, the object is in shadow.
      • Major aliasing problem, but implemented in hardware

April 15, 2013 (^19)

Light

Shadow Map

By keeping the same far clipping plane, relative distances in Z are preserved

Advanced Techniques (Environment

Mapping)

  • A way to render reflections (also called reflection mapping)
    • Simulates reflections with a texture map applied to the enclosing

sphere or cube of an object

  • Texture map can either be an existing image or a rendering of the

scene from the object’s perspective

  • Cube environment map is created by stitching together 6 textures,

each generated by rendering the scene from the object’s POV

  • Ray from eye is reflected over surface normal and intersected with the

environment map to get texture coordinates.

Shiny metal effect using environment map.