Plane Equation

Texgen modes GL_OBJECT_PLANE and GL_EYE_PLANE are generating texture coordinates based on the distances of vertices from a plane.



A plane in 3 dimensions can be defined by the equation:

        Ax + By + Cz + D = 0

This is an implicit formula - it defines a plane as the set of points that satisfy the equation. In other words, it serves as a test to determine whether or not a particular point [x y z] is on the plane or not.

Another interpretation is that the value of

Ax + By + Cz + D

is proportional to the distance of the point [x y z] from the plane.



Meaning of the coefficients

The vector [A B C] is normal (perpendicular) to the plane.
Thus, it defines the plane's orientation.

e.g.: A=1, B=0, C=0 defines a plane perpendicular to the X axis, or parallel to the plane of the Y & Z axes.
The plane equation in this case would reduce to x = -D.

D controls the distance of the plane from the origin. If [A B C] is a unit vector, then D is equal to the distance from the plane to the origin.

Note that if, for a given [x y z], Ax + By + Cz + D = 0, then 2Ax + 2By + 2Cz + 2D = 0, and in general:

        NAx + NBy + NCz + ND = 0

In other words, multiplying the four coefficients by the same constant N will still define the same plane.

However, the value of NAx + NBy + NCz + ND will be N times the value of Ax + By + Cz + D. This is useful in texture coordinate generation.



next