Lighting and Shading

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

When do you actually see an object and distinguish its colour?

When light bounces off an object, reflected by its surface, and into your eyes.

2
New cards

What is shading?

The process of altering the colour of an object based on the type of light source that is emitting light, and how light is reflected from object surfaces to create a realistic effect.

3
New cards

What are the three types of shading?

  • flat shading

  • gourand (smooth) shading

  • phong shading

4
New cards

What is flat shading?

when each face of an object is assigned a colour.

5
New cards

What is gourand (smooth) shading?

We apply lighting against a normal vector at each vertex to calculate the colour of each vertex in the vertex shader. Colours across a face are generated by interpolating colours obtained at the edge vertices of the face during rasterization.

6
New cards

What is phong shading?

We apply lighting against normal vectors at each point over an object surface by interpolating normal vectors at the corner vertices during rasterisation. Then we colour the surface based on the interpolated normal vector at each point in the fragment shader.

7
New cards

All this talk about normal vectors - what are they?

The orientation of a surface is specified by the normal vector, the direction perpendicular to that surface. This is expressed with (x, y, z) points in a matrix.

8
New cards

When do we set up the normal matrix in WebGl?

After the transformation pipeline in main().

9
New cards

What are the three different types of light in computer graphics?

  • directional light

  • point light

  • ambient light

10
New cards

What is directional light?

Parallel light rays that shine down on an object from a far-away source, like the sun. Produces diffuse reflection.

11
New cards

What is point light?

Light rays are produced in all directions from a point, like a light bulb. Produces diffuse reflection.

12
New cards

What is ambient light?

Indirect light produced from all light sources and reflected light from objects. Produces ambient reflection.

13
New cards

With lighting, what does the surface colour end up as? (calculation)

surface colour = diffuse reflection + ambient reflection

14
New cards

So, what is diffuse reflection?

The reflection of light from a directional/point light source. Light is reflected equally in all directions from where it hits.

15
New cards

How do you find the surface colour after diffuse reflection?

surface colour = light colour x base surface colour x cosθ

Where θ = light direction * orientation of surface

16
New cards

And what is ambient reflection?

The reflection of light from all indirect sources, illuminating an object equally from all directions with the same intensity.

17
New cards

How do you calculate ambient reflection?

surface colour = light colour * base surface colour.

18
New cards

What WebGl is required for a directional light source?

in main(): light colour, light direction
in vector shader: normalised normals, diffuse calculations.

19
New cards

What WebGL is required for a point light source?

The same as directional, just with ambient added.

20
New cards

How do you set up Phong Lighting:

All the calculations go in fragment shader, and the lightDirection is calculated by:
vec3 lightDirection = normalise(u_LightPosition – v_Position);