| Researches on computer-generated hair can be traced back to 1980s. However, due to the restrictions of hardware and graphic technology at that time, the hair generated lacked verisimilitude and the generation speed was very slow. Graphic researchers have been working hard to solve the two problems and they have made great achievements since then. Today computer-generated hair technology is still a research focus.This thesis designs and implements a real-time hair rendering algorithm framework, which can achieve a faster speed with the support of graphic hardware.This thesis mainly studies such issues as hair modeling, stress analysis, collision detection, hair illumination, shadow generation etc.In the thesis, it is regarded that basically hair is made up of hair bundles each of which is composed of many similar hairs. Therefore, if a key hair is drawn, then other hairs can also be drawn by doing some property adjustment to the key hair. The description to one hair bundle then becomes the description to a key hair, which greatly reduces the data size of hair description and makes the computation simplified. Every key hair is constituted by a series of particles each of which contains such information as position, color, direction etc. A hair can be generated by drawing these particles smoothly and other hairs in the same bundle can be generated by adjustment to the key hair.After establishing the basic hair model, this thesis studies hair bending model. Hairs would grow straightly along the scalp without any influences of external forces, but they will bend because of the role of force and the best way to solve this problem is to adopt cantilever model in engineering mechanics.To get vivid hair model, light is necessary. Common illumination model is not suitable due to the large number of hairs. This thesis adopts Kajiya-Kay's classic hair illumination model to compute hair illumination so that vivid three-dimensional hair model can be achieved. This illumination model can be conveniently realized by shading language and achieve good visual effects. Kajiya-Kay's illumination model is one of the truest hair rendering algorithms.Lighting effects by themselves are not enough to the realization of such complicated three-dimensional geometry as hairs, and the self-shadow information of hairs plays a very important role in this realization. Shadow map technique is commonly adopted in shadow drawing, but due to the limitations of traditional shadow map algorithm it cannot deal with three-dimensional mass density like hairs. This thesis adopts opaque shadow map algorithm to generate self-shadow information of hairs. This algorithm extends common shadow map so that it can deal with volume and is against distortion, therefore, it is suitable for generating the self shadows of discontinuous objects such as leaves, hairs etc. This algorithm is suitable for being achieved by adopting hardware, supports 3D texture hardware, and makes rendering speed faster.Using OpenGL as its development tool together with GLSL. which makes most of the rendering implement at vertex shaders and fragment shaders of GPU, this algorithm has good portability, and is simple, easy, and efficient. It can achieve high quality rendering output with common hardware configuration. |