Graphics Reference
In-Depth Information
Figure 14-9
2D Texture Projected onto Object
The idea behind projective lighting is to transform the position of an
object into the projective view space of a light. The projective light
space position, after application of a scale and bias, can then be used as
a projective texture coordinate. The vertex shader in the PVRShaman
example workspace does the work of transforming the position into the
projective view space of a light.
There are three matrices that we need to transform the position
into projective view space of the light and get a projective texture
coordinate:
•
Light
projection
—projection matrix of the light source using the
field of view, aspect ratio, and near and far planes of the light.
•
Light view
—The view matrix of the light source. This would be
constructed just as if the light were a camera.
•
Bias matrix
—A matrix that transforms the light-space projected
position into a 3D projective texture coordinate.