basic rendering methods - korea

22
Graphics Graphics Lab @ Korea University http://kucg.korea.ac.kr Basic Rendering Methods Korea Univ. Computer Graphics Lab.

Upload: others

Post on 15-Apr-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Basic Rendering Methods - Korea

Graphics

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

Basic Rendering Methods

Korea Univ.

Computer Graphics Lab.

Page 2: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Polygon Shading

Spatial Coherence

Illumination calculations for pixels by the same primitive

http://kucg.korea.ac.kr

Page 3: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat Shading

Constant-intensity Shading

OK for polyhedral objects

Not so good for ones with the smooth surfaces

http://kucg.korea.ac.kr

Page 4: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat Shading Process

One illumination calculation per polygon

All pixels inside each polygon will be the same color

i i

n

SiDALAE IKIKIKII ))RV()LN(( ii

Polygon Normal Vector

http://kucg.korea.ac.kr

Page 5: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat Shading in OpenGL

glShadeModel(GL_FLAT)

http://kucg.korea.ac.kr

Page 6: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shading

Intensity-interpolation Scheme

Produces smoothly shaded polygonal mesh

Shows some illumination highlights

Still can’t capture subtle lighting effects

Needs extremely fine mesh

Effectively reduced by Phong shading

<Flat Shading vs. Gouraud Shading>

http://kucg.korea.ac.kr

Page 7: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shading Process (1/2)

One lighting calculation per vertex

Interpolates pixels inside polygon

By using the colors computed at vertices

i i

n

SiDALAE IKIKIKII ))RV()LN(( ii

Vertex Normal Vector

Viewer Light

N1

N3

V1 L1

Polygon

N2

http://kucg.korea.ac.kr

Page 8: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Vertex Normal Vector

Average of the surface normals

From polygons sharing that vertex

N2

N3

N4

N1

http://kucg.korea.ac.kr

Page 9: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shading Process (2/2)

Bilinearly interpolate colors at vertices

Down and across scan lines

I1

I2 I3

21 I1IA 31 I1IB

BA1I

I

1,,0

http://kucg.korea.ac.kr

Page 10: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shading in OpenGL

glShadeModel(GL_SMOOTH)

http://kucg.korea.ac.kr

Page 11: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shading of Highlights

by the Primitives’ Size & Location

http://kucg.korea.ac.kr

Page 12: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Phong Shading

Normal-vector interpolation shading

Can capture subtle illumination effects in polygon

interiors

Not supported by OpenGL/DirectX

http://kucg.korea.ac.kr

Page 13: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Phong Shading Process (1/2)

One lighting calculation per pixel

Approximate surface normals for inside points

Viewer Light

N3

V1 L1

Polygon

N2

i i

n

SiDALAE IKIKIKII ))RV()LN(( ii

N1

Pixel Normal Vector

http://kucg.korea.ac.kr

Page 14: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Phong Shading Process (2/2)

Bilinearly interpolate surface normals at vertices

21 N1NA 31 N1NB

BA1N

N1

N3 N2

N

http://kucg.korea.ac.kr

Page 15: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat vs. Gouraud vs. Phong (1/2)

http://kucg.korea.ac.kr

Page 16: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat vs. Gouraud vs. Phong (2/2)

Wireframe Flat Shading

Gouraud Shading Phong Shading

http://kucg.korea.ac.kr

Page 17: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Wireframe

http://kucg.korea.ac.kr

Page 18: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Ambient Only

http://kucg.korea.ac.kr

Page 19: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Flat Shaded Polygons with

Diffuse Reflection

http://kucg.korea.ac.kr

Page 20: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shaded Polygons with

Diffuse Reflection

http://kucg.korea.ac.kr

Page 21: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Gouraud Shaded Polygons with

Specular Reflection

http://kucg.korea.ac.kr

Page 22: Basic Rendering Methods - Korea

KUCG

Graphics Lab @ Korea University

Phong Shaded Polygons with

Specular Reflection

http://kucg.korea.ac.kr