本文探讨了OpenGL的光照计算原理以及法线在光照计算中的作用,针对规则格网地形的几何结构特征提出了直接计算、方程法以及迭代法计算地形平均法线的3种方法,并分析了各自的优缺点。实验证明,迭代法由于用加法代替乘法计算,同时又避免了不必要的重复法线计算,计算效率具有明显优势。
Illumination calculation is the key to draw realistic terrain, and normal calculation and illumination calculation of ge- ometry elements are also closely linked. This paper discussed the principle of illumination calculation of OpenGL and the role of normal calculation in illumination calculation, proposed direct calculation method, equation method and iterative method used to calculate the average normal of terrain, and analyzed their advantages and disadvantages. Experiments showed that the iterative method has obvious advantages on computational efficiency for it uses addition instead of multiplication, meanwhile avoids unnecessary duplication of nor- mal computing.