GLKEffectPropertyLight
Lighting information for use in GLKit rendering effects.
Declaration
class GLKEffectPropertyLightOverview
The lighting model implemented by GLKEffectPropertyLight is identical to the lighting model implemented in OpenGL ES 1.1; each light interacts with any material properties on the effect to determine the intensity and color that particular light contributes to the scene at a fragment.
There are three basic kinds of lights: directional, point and spotlights.
A directional light is considered to be infinitely far away, and always directs light in the same direction. To create a directional light, set the position property to a vector whose
x,y, andzcomponents specify the direction to the light (that is, the negation of the direction the light is travelling in), and whosewcomponent is set to0.0.A point light is placed at a position within the scene, and emits light in all directions. To create a directional light, set the position property to a vector whose
x,y,zandwcomponents specify the homogenous coordinates for the position of the light in the scene. Thewcomponent is typically set to1.0and must not be set to0.0.
The intensity of a point light is adjusted using an distance attenuation function. This function is controlled by adjusting the constantAttenuation, linearAttenuation or quadraticAttenuation properties. The default values for these properties create a light whose intensity is constant over distance.
A spotlight is placed at a position within the scene, and emits light in a specific direction in a cone. To create a spotlight, set the position property to a vector whose
x,y,zandwcomponents specify the homogenous coordinates for the position of the light in the scene. Thewcomponent must not be set to0.0. Then, set the spotDirection property to a vector that specifies the direction of the light and the spotCutoff to a value less than180.0.
Like a point light, a spotlight’s intensity can be adjusted using the distance attenuation properties. A spotlight’s intensity can also be changed as a function of the spotlight angle by setting the spotExponent property. The default value for a spotlight creates a spotlight whose intensity is not affected by the angle. That is, the spotlight radiates the same amount of light at the center and at the edge of the cone.
Lighting calculations are performed in eye-space coordinates. The eye-space coordinates for the position and the spot direction are calculated at the precise moment that new position values are specified and may be affected by other properties of the effect. For more information, see GLKBaseEffect.