| Illumination Consistency is the key to achieving realistic sense in augmented reality.How to fuse a virtual three-dimensional object into graphics has been a tough work in the fusion of the virtual and the real.To solve this problem,it is even more difficult to obtain three-dimensional illumination direction from two-dimensional graphics.Therefore,relevant researches have been carried out and main achievements are as follows:(1)A method of light intensity estimation based on marker balls is designed.Firstly,based on the scene marker ball whose size,shape and color are known,the dot product of the light source vector and the mark ball surface vector is taken to extract the illumination visible area where the sampling points are selected based on the illumination information.Then the illumination brightness of each sampling point is estimated based on the Cook-Torrance illumination model to obtain its average value as the illumination intensity in the original scene.Secondly,because the pixel values of two adjacent points in different position are totally different,the initial seed points are selected iteratively.And then,the shadow area where the marker ball is located is extracted relied on difference in the four fields of the seed point and the pixel value of the seed point as well as the size of the given threshold.Finally,the depth information of the model is obtained based on the determined model and the shadow area;(2)A method for obtaining the position and direction of a light source is established.Firstly,according to the marker ball and its shadow area as well as its depth information,combined with the transformation matrix between the projection matrix and the different coordinate systems,the three-dimensional feature point of the scene space is obtained to determine the closest point in the marker sphere and the shadow area.There is a point in the shadow area where the distance between the two points is the greatest between any two points in the area and marked as point A.And then four points are determined.They are point B and point C which are most distant from point A in the model and shadow area,and the center O and center D of the model and the shadow area respectively.Finally,according to the position between the point O,the point D and the light source as well as the characteristic that point B and point C are on the same straight line,the three-dimensional spatial position of the light source is determined through the ray tracing algorithm;(3)A method for drawing shadows of virtual objects is employed.Firstly,the virtual object model is meshed and then the illumination area of the light source is determined according to the included angle between the light source vector and each grid normal vector of the model.Further,the outer contour of the model is extracted based on the fact that there is a common edge between adjacent grids in the illumination area of the light source and the edge grids of the area are independent.Finally,the ultimate shadow of the model is formed by projecting the outer contour of the model based on the projection transformation. |