通过对阴影图算法进行扩展,提出一种完全基于GPU的近似软影实时绘制算法,它是一种3遍算法:第一遍从光源中心计算场景的深度图;第二遍采用几何着色器提取物体的轮廓边,同时在轮廓边上生成新的几何图元,利用硬件自动插值功能向外绘制线性近似半影图,并根据第一遍得到的深度图在像素着色器中对背面轮廓形成的半影区进行剔除;对于重叠的半影区设定片元的伪深度值,利用硬件进行自动融合.第三遍分别查询深度图和半影图,确定场景的本影区以及半影区中像素的亮度,从而得到面光源照射下场景的近似软影效果.
This paper presents a real-time approximate soft shadow rendering algorithm which runs entirely on GPU by extending the shadow mapping algorithm. This is an algorithm with three passes. In the first pass the depth map is generated from the light view point. It is then followed with the second pass to extract the silhouette edge using geometry shader and to generate penumbra map by extending the silhouette vertex along the normal. The new generated primitive is automatically interpolated by GPU. For the part of the penumbra map which is occluded, it is diminated using the depth map generated in the first pass in fragment shader. For the overlapped part, a fake depth value is set for each of the fragments so that they will be blended automatically by hardware through depth comparison. In the rendering pass, for each fragment we first lookup the depth map to decide whether the fragment is in shadow. For those not in shadow, we lookup the penumbra map to get the penumbra value.