Computer Graphics Seminar LIGHTING MODELS What is a

  • Slides: 125
Download presentation
Computer Graphics Seminar LIGHTING MODELS

Computer Graphics Seminar LIGHTING MODELS

 What is a light? Types of light Illumination models Shading models

What is a light? Types of light Illumination models Shading models

 What is a light? Illumination models Shading models Lighting models

What is a light? Illumination models Shading models Lighting models

What is a light?

What is a light?

Delta Lights Light entities with no physical size Used because simulating area lights was

Delta Lights Light entities with no physical size Used because simulating area lights was for a very long time too expensive today should be avoided as much as possible

 What is a light? Types of light Illumination models Shading models

What is a light? Types of light Illumination models Shading models

Types of light Directional Point light Spotlight

Types of light Directional Point light Spotlight

Directional light

Directional light

Point Light

Point Light

Point light VS Spotlight

Point light VS Spotlight

Spotlight

Spotlight

 What is a light? Types of lights Illumination models Shading models

What is a light? Types of lights Illumination models Shading models

Illumination Models Global Illumination = Ambient Light + Diffuse Light + Specular Light +

Illumination Models Global Illumination = Ambient Light + Diffuse Light + Specular Light + Emissive Light

The emissive • Each polygon is self-luminous ligthing (it lights itself, but does not

The emissive • Each polygon is self-luminous ligthing (it lights itself, but does not give off light) • There are no lights in the scene • Each polygon has its own colour which is constant Over its surface That color is not affected by anything else in the world position of viewer is not important

Calculating Emissive Term emissive = Ke where: Ke is the material's emissive color.

Calculating Emissive Term emissive = Ke where: Ke is the material's emissive color.

The Ambient Term Ambient light does not appear to come from any particular direction,

The Ambient Term Ambient light does not appear to come from any particular direction, rather it appears to come from all directions, because of this it does not depend on light source position.

Calculating Ambient Term ambient = Ka x global. Ambient Where : Ka is the

Calculating Ambient Term ambient = Ka x global. Ambient Where : Ka is the material's ambient colour global. Ambient is the color of the incoming ambient light.

Diffuse Term comes from a specific direction

Diffuse Term comes from a specific direction

Diffuse Term The diffuse term accounts for directed light reflected off a surface equally

Diffuse Term The diffuse term accounts for directed light reflected off a surface equally in all directions.

The Diffuse Term diffuse = Kd x light. Color x max(N · L, 0)

The Diffuse Term diffuse = Kd x light. Color x max(N · L, 0) Kd is the material's diffuse color light. Color is the color of the incoming diffuse light N is the normalized surface normal P is the point being shaded. L is the normalized vector toward the light source

The Specular Term Light is reflected from the surface in mirror direction brightness depends

The Specular Term Light is reflected from the surface in mirror direction brightness depends on theta - angle between surface normal (N) and the direction to the light source Rendering the specular term

The specular Term

The specular Term

Specular Term

Specular Term

Adding The terms together

Adding The terms together

Ambient+Diffuse+Specular

Ambient+Diffuse+Specular

Material Properties Demo diffuse color -how the material reflects light diffusely specular color –how

Material Properties Demo diffuse color -how the material reflects light diffusely specular color –how material reflects light specularly http: //math. hws. edu/graphicsbook/c 4/s 1. html

Different Lighting Models

Different Lighting Models

Phong Lighting Model

Phong Lighting Model

Phong Ligthing model

Phong Ligthing model

Blinn-Phong Lighting Model Another, a bit more realistic, lighting model is the Blinn-Phong model

Blinn-Phong Lighting Model Another, a bit more realistic, lighting model is the Blinn-Phong model that calculates the specular term somewhat differently.

Blinn phong VS phong

Blinn phong VS phong

real-world photograph

real-world photograph

 What is a light? Types of light Illumination models Shading models

What is a light? Types of light Illumination models Shading models

What is shading?

What is shading?

Shading models There are three main shading models that are used for different result.

Shading models There are three main shading models that are used for different result. Flat Shading Gouraud Shading (per vertex) Phong Shading (per fragment)

Three main shading models

Three main shading models

3 D mesh Consists of: Vertices, edges that form faces, Face normals - orthogonal

3 D mesh Consists of: Vertices, edges that form faces, Face normals - orthogonal to the face. Normals + light source we determine Colour of the face.

Flat Shading (per polygon) It defines a single color for a face. main idea

Flat Shading (per polygon) It defines a single color for a face. main idea is that we use only one surface normal per polygon The color itself is uniform (unchanging) on that polygon.

Flat shading is in screen space ⊕ easiest to implement, really fast ⊖ ugly

Flat shading is in screen space ⊕ easiest to implement, really fast ⊖ ugly results, only good results if mesh resolution is such that one face corresponds to one pixel on the screen, this breaks down when zooming in.

Example of Flat Shading Model

Example of Flat Shading Model

Linear interpolation

Linear interpolation

Positive and Negative sides of Gouraud Shading - is in screen space ⊕ pretty

Positive and Negative sides of Gouraud Shading - is in screen space ⊕ pretty efficient and not too hard to implement, nice shading on medium to high mesh resolution ⊖ looks bad on low mesh resolution, has perspective distortion, which can also be noticed on rotation of the object or if you change the triangle shapes. ⊖ if the light source is specular and focused on a very small area, Gouraud Shading might not render it correctly (if it doesn’t hit and illuminate a vertex, but only hits a face or an edge of the mesh)

Example of Gouraud Shading

Example of Gouraud Shading

Phong shading

Phong shading

Results of Phong Shading ⊕ great shading of round and smooth objects at any

Results of Phong Shading ⊕ great shading of round and smooth objects at any mesh resolution ⊖ can’t change the mesh contour ⊖ is more challenging to implement and takes longer to compute than the other two algorithms ⊖ always assumes a smooth basic shape, i. e. if the object we want to display has sharp edges that should actually be sharp (e. g. if we try to render a cube), it will make the edges look somewhat round instead of shading the faces in different light.

Example of Phong Shading http: //multivis. net/lecture/phong. html

Example of Phong Shading http: //multivis. net/lecture/phong. html

If the object resolution is higher

If the object resolution is higher

Fog makes objects that are further away look less distinct than near objects

Fog makes objects that are further away look less distinct than near objects

Why is fog shading needed ?

Why is fog shading needed ?

The monster sees a much softer horizon

The monster sees a much softer horizon

Thank you !

Thank you !