March 2013
Intermediate to advanced
984 pages
26h 18m
English
Projective texturing is employed when a perspective transformation matrix has been used to transform texture coordinates. The input to the transform is a set of homogeneous coordinates and the resulting output of this transform is a vector whose last component is unlikely to be 1. The textureProj function can be used to divide through by this final component, projecting the resulting texture coordinate into the coordinate space of the texture. This is useful for techniques such as projecting decals onto flat surfaces (e.g., the halo projected by a flashlight) or in shadow mapping21. Some example prototypes are given below. (A full list is in Appendix C, “Built-in GLSL Variables and Functions”.)
21. An in-depth example of ...