Lights
- This is chapter 4 (sort of) in your book
- I am referencing 4.1 right now.
- But the commands in this section are specific to opngGL 1.x
- And WILL NOT WORK in webgl.
- Lights have changed.
- Or more appropriately been removed.
- A great demo is here
- I did not write this one.
- But it is superb.
- This represents two old lighting models
- Gourand Shading, at the triangle level.
- Set the model to sphere to see the difference.
- Phong-Blin Shading at the pixel level.
- These models are polygon
- Again, use the sphere model and look at the edges.
- For this discussion, consider a "point" light source
- It really has no width or height, it is a point.
- Nothing to "see" in the reflection.
- It emits light in all directions.
- But later we can control this.
- The idea behind the two models are essentially the same.
- Light is made up of three different components.
- Ambient light is light that just fills the room.
- Natural background light.
- This is the roundoff error.
- Everything everywhere in the scene is light by this light.
- Secular light or secular reflected light is light that is reflected by smooth surfaces.
- This is the shiny spot
- Perhaps the direct reflection of the light source.
- This is related to the position of the viewer.
- Diffuse light or diffuse reflected light is the light that is reflected from less reflective material.
- This is the light that is not absorbed by the item.
- The book has a great image for this
-
- These reflections are a combination of the properties of
- The material doing the reflection
- The the light being reflected.
- Light properties include
- The position of the light.
- The orientation of the light, spotlight vs
- The color of the light
- The attenuation or "fall off" of the light.
- Along with position we can assign properties to the model as well
- Color is normally replaced with ambient, secular and diffuse color components.
- In this model we also assign a shininess value to the material.
- And we will defiantly need vertex normals
- Sometimes we allow a material to generate light
- This is the emissive color of the material.
- This does not change the color of nearby objects.
- And is not part of the classical color model.
- Color related items are usually 3 vectors
- These are now describing the reflectivity of the components.
- <0.0, 1.0, 0.5> reflects no red light, completely reflects green, and absorbed/reflects 50% of the blue light.
- Normal Vectors
- A polygonal shaded model uses one normal per polygon.
- This is called flat shaded
- A fragment or pixel shaded model uses an interpolated normal at each point.
- This is called smooth shading
- Normal vectors will need to be transformed with the object.
- But be careful of non-uniform scaling
- The lighting model
- The model we are about to discuss is a crude attempt to model lighting.
- It does not include shadows, reflections, transparency, or other items.