nmode(3G)
nmode - specify renormalization of normals
Showing IRIX 6.5.30 (default release). Unchanged since IRIX 6.5.
NAME nmode - specify renormalization of normals FORTRAN SPECIFICATION subroutine nmode(mode) integer*4 mode PARAMETERS mode expects a symbolic constant. There are two defined constants for this parameter: NAUTO causes normals to be renormalized only if the current ModelView matrix is not orthonormal. (default) NNORMALIZE causes normals to always be renormalized, regardless of the current ModelView matrix. DESCRIPTION IRIS systems transform vertex normals from object-coordinates to eye- coordinates before doing lighting calculations. While the matrix mode is MVIEWIN, a separate Normal matrix is maintained to support this transformation. The Normal matrix is the inverse transpose of the upper-left 3 x 3 portion of the ModelView matrix. Transformed normals must be unit length if the lighting calculations are to be meaningful. Transformed normals will be unit length if 1) they were unit length in object-coordinates, and 2) the current Normal matrix is orthonormal (see notes). If one or both of these conditions are not met, the normal must be normalized (corrected to have unit length) after it is transformed. nmode helps the system determine when normalization is required. Each time the ModelView matrix is changed, the IRIS determines whether the resulting (inverse-transpose) Normal matrix is orthonormal or not, and saves the result of the test as a flag. After each normal is transformed, both this flag and the nmode flag are tested. If nmode is NAUTO, the normal is normalized if and only if the flag is set (i.e. the ModelView matrix is not orthonormal). NAUTO mode is appropriate when the model normals are known to be unit length. If nmode is NNORMA, the normal is normalized unconditionally. NNORMA mode is appropriate when the model normals may not be unit length. NAUTO is the default nmode. Because normalization involves division by a computed square root, it can adversely affect system performance. SEE ALSO mmode, loadma, multma, rot, scale, transl, lmbind NOTES IRIS-4D G, GT, and GTX models, and the Personal Iris, do not support nmode. nmode cannot be used while draw mode is MSINGL. On Impact and Infinite Reality NAUTO is not supported. Normals are always normalized. For our purposes a matrix is orthogonal if it transforms normals to the same length regardless of their direction, and it is orthonormal if this length is the same as the untransformed length. Rotation matrixes are always orthonormal. Scale matrixes are orthogonal but not orthonormal if the three scale values are identical, neither orthogonal nor orthonormal otherwise. Uniform scale ModelView matrices can be normalized to the identity matrix, and are therefore ignored by the Normal matrix. Translations do not affect the upper-left 3x3 ModelView matrix, and are therefore also ignored by the Normal matrix. The length of a normal is the square root of its dot product with itself.