Lighting

9 flashcardsby Nijelous
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Shading models
Per Surface (Flat shading)
-Each primitive has a normal, no interpolation, each pixel is the same
-Calculated in vertex shader with flat modifier
-Early 3D (Super Mario 64)

Per Vertex (Gourard shading)
-Each vertex has a normal, with the final calculations being carried out per vertex and interpolated
-Calculated in vertex shader
-Early 2000s 3D

Per Fragment (Phong shading)
-Each vertex has a normal, interpolated across the primitive
-Final calculations are calculated per fragment
-Calculated in fragment shader
-Modern 3D
2
Phong Reflection Model
Uses 4 different kinds of light to render light in a way that is close enough to how light works

Ambient: Lights everything equally, bunces off objects to be everywhere.
-One in a scene, no direction

Diffuse: Light from a specific source, scattered equally from the surface being drawn

Specular: Light from a specific source, reflected towards the camera from the surface being drawn. Highlights.

Attenuation: Weakening of light sources as you get further away
3
Diffusion Calculation
Diffusion factor = Normal.Incident
-Normal = vector pointing off surface at a right angle
-Incident = normalised(light position - surface position)

Diffuse = Light diffuse colour * diffusion factor
4
Specular Calculation
Specular factor = Normal.Half angle
-Half Angle = The angle between the viewing angle and the incident vector

Specular = light specular colour * specular factor^n
-n = specular power, high for shiny material, low for rough material
5
Attenuation Calculation
Attenuation = 1 - (Distance/Max Distance)

Distance is from light source to surface

Max Distance is how far the light can cast
6
Final light calculations
Final Diffuse = Surface Diffuse Colour * Diffuse * Attenuation

Final Specular = Surface Specular Colour * Specular * Attenuation

Final Colour = Ambience + Final Diffuse + Final Specular
7
Normal
The unit vector perpendicular to the surface, can be calculated as the cross product of two sides of a surface.
8
Static Lighting
A texture that defines the light of a surface, combining it with a light map.

No real time changes, but quick
9
Bump Mapping
A process of rendering polygons that gives them an illusion of depth.

A normal map is stored in the texture, with each texel having a normal.

The map wraps around the object like a texture, and provides greater depth to the specular and diffusion lighting.
Study all 9 cards for free