1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Lecture computer graphics and virtual reality slides lesson 10 illuminiation and shading

52 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Illumination and Shading
Định dạng
Số trang 52
Dung lượng 1,59 MB

Nội dung

Trang 4 How lights can be seen?■ The eye works like a camera■ Lots of photo sensors at the back of the eye■ Sensing the amount of light coming from different directions■ Similar to CMOS

Trang 1

Lesson 10

Illuminiation and

shading

Trang 2

1 Overview

2 Illumination

3 Shading

Trang 3

Overview

Trang 4

How lights can be seen?

■ The eye works like a camera

■ Lots of photo sensors at the back of the eye

■ Sensing the amount of light coming from different directions

■ Similar to CMOS and CCDs

Information will be sent

to brain for processing

Trang 5

What colour is this dress?

Trang 6

Object’s colour

■ What Affects the Color of a Point on the Object?

□ position of the sample point

□ position of the light

□ color and intensity of the light

□ camera vector

□ normal vector of the surface at the vertex

□ physical characteristics of the object

(reflectance model, color)

Trang 7

Colour’s illusion

Trang 8

Lighting and shading

■ Lighting

□ How to compute the color of objects according to the position of the light, normal vector and camera position

■ Shading

□ Different methods to compute the color of the

entire surface

Trang 9

Lighting

Trang 10

Factors affecting lighting

Light source Surface properties

Trang 13

in 3D space, we can specify a pixel correspondingly.

The task in lighting is that we have to specify the colour of that pixel

■ If we want to make the scene look *right*, we

have to simulate the lighting process on the surfaces

inside the scene

Trang 14

Lighting models

■ Two types of lighting models

□ Empirical: Use simple formulas to create similar

observable result

□ Physics simulation: The lighting formulas will be based on physics formulas in lighting

■ In most cases, experimental models will be used

in interactive computer graphics applications

■ In modern computer graphics applications,

some physic simulation models have been more frequently used

Trang 15

Phong lighting model

■ By Bui Tuong Phong (Utah University) is a lighting model which is a combination of both experimental and physics simulation

■ Is the sum of 3 illumination terms

Ambient : 'background' illumination

Diffuse : non-shiny illumination and shadows

Specular : bright, shiny reflections

Trang 16

Ambient light

Trang 17

Ambient light

■ Light from the environment

■ Light reflected or scattered from other objects

■ Coming uniformly from all directions and then reflected equally to all directions

■ A precise simulation of such effects requires a lot of computation

Use a simple “trick” called ambient light

Trang 21

Example: Ambient light

Trang 22

What about this?

Trang 23

Diffuse light

Trang 24

Diffuse light

■ When light hits an object

□ If the object has a rough surface, it is reflected to

various directions

Result: Light reflected to all directions

What are the factors affecting diffuse light intensity?

Trang 25

Diffuse light

■ The smaller the angle between the incident

vector and the normal vector, the higher the chance that the light is reflected back

■ When the angle is larger, the reflection light gets weaker because the chance the light is shadowed / masked increases

Trang 26

Lambert’s Cosine Law

“The radiant intensity or luminous intensity observed from an ideal diffusely reflecting surface or ideal diffuse radiator

is directly proportional to the cosine of the angle θ between the direction of the incident light and the surface normal”

n l

Trang 27

Example: Diffuse Light

■ Not depend on viewing direction

■ Only depend on the angle between light source and surface normal

Trang 28

Diffuse light

I = k d I p cos 

■ Ip: diffuse reflectivity

■ : the angle between the normal vector

direction towards the light

■ kd: Light Intensity

E.g sphere (light from the left) Does NOT depend on camera’s position

Trang 29

Specular light

Trang 30

Specular reflection

■ Direct reflections of light source off shiny object

□ The object has a very smooth surface

□ E.g gloss metal, car surface

Specular Highlight

Trang 31

Specular reflection

■ Reason: In microscope level, the surface of

specular surface is very smooth, therefore the

specular reflection is similar to reflection on mirror

■ The smoother the surface, the more it looks like

a mirror

Following Snell’s law

l = r

Trang 32

Specular reflection

■ For *less than ideal* surface

□ Instead of having to model the microscopic level of the surface to handle conventional reflection

□ When the light touches the surface, some of the light will be reflected in a slightly different direction than the ideal ray.

□ Higher the angle of deviation from the ideal

reflector, the less light reflected

Trang 33

Specular highlight

■ specular intensity n = shiny reflectance of object

Result: specular highlight on object

This is an empirical calculation and isn’t based on

any physics formula

( )n shiny

p

sI k

E.g a sphere

Does NOT depend on surface’s colour

Trang 34

Changing the n-shiny

■ Reflection with different nshiny value

Trang 35

Phong lighting model

Trang 36

Phong lighting model

■ By Bui Tuong Phong (Utah University) is a lighting model which is a combination of both experimental and physics simulation

■ Is the sum of 3 illumination terms

Ambient : 'background' illumination

Diffuse : non-shiny illumination and shadows

Specular : bright, shiny reflections

Trang 37

Phong lighting model

■ Resulting intensity will be calculated by the sum of all terms

𝐼 = 𝐼𝑎𝑘𝑎 + 𝐼𝑝 𝑘𝑑 cos 𝜃 + 𝑘𝑠 cos𝑛 𝜑

■ If there are many light sources

□ Calculate the sum of all light intensity

𝑝 𝑙𝑖𝑔ℎ𝑡𝑠

𝐼𝑝 𝑘𝑑 cos 𝜃 + 𝑘𝑠 cos𝑛 𝜑

Trang 38

Phong lighting model

We can also use dot product

V: Vector from the surface to the viewer

N: Normal vector at the colored point

R: Normalized reflection vector

L: Normalized vector from the colored

point towards the light source

d p

a a

shinyR

V k L

N k

I I

k

I

1

ˆ ˆ ˆ

ˆ

Trang 39

Shading

Trang 40

■ The illumination model computes the color of sample points

■ How do we color of the entire object?

➢ This is done at the rasterization level

■ The procedure to color the entire surface is

called shading

Trang 41

Flat shading

■ Compute the color at the middle of the polygon

■ All points in the same polygon are colored by the same color

■ Works well for objects really made of flat faces

Trang 42

Example scene: Flat shading

Trang 43

Flat shading: Problem

■ Suffers from Mach band effect

□ Humans are very sensitive to the sudden change of the brightness

■ The artefact remains although the polygon

number is increased

Trang 45

Example scene: Goraud shading

Trang 46

Goraud shading: Problem

■ For specular

reflection, highlight falls

off with cosnα

may well miss a

highlight that occurs in

the middle of the face

Trang 47

Phong shading

■ by Bui Tuong Phong

■ Doing the lighting computation at every pixel during rasterization

■ Interpolating the normal vectors at the vertices (again using barycentric coordinates)

Trang 48

Phong shading process

1 For every vertex of the object, compute its

normal vector

2 Project the vertices onto the screen

3 When rasterizing the pixels, interpolate the

normal vector, position of the point (and the light and camera vector if necessary) using barycentric coordinates, and do the lighting computation

Trang 49

Example scene: Goraud shading

Trang 50

Comparison between shading techniques

Trang 51

Any questions?

Trang 52

Lecture notes provided by School of Information and

Communication Technology, Hanoi University of Science and

Technology.

Composed by Huynh Quyet Thang, Le Tan Hung, Trinh Thanh

Trung and others

Edited by Trinh Thanh Trung

Special thanks to all the people who made and released these awesome resources for free:

■ Presentation template by SlidesCarnival

■ Photographs by Death to the Stock Photo ( license )

■ Diverse device hand photos by Facebook Design Resources

Ngày đăng: 02/03/2024, 14:00

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN