群体仿真在虚拟现实、影视动画、计算机游戏等领域有着广泛的应用。大规模的群体仿真中每个个体都要同其感知范围内的其他个体相互作用,当实时更新所有个体的状态时,就会导致O( N2)计算量的问题。针对这一问题,实现了一种基于GPU(图形处理器)的BOIDS群体行为模拟算法,充分利用GPU并行计算的能力处理大规模群体运动的巨大计算量。该方法利用GPU的快速光栅化计算每个个体同其感知范围内的其他个体的相互作用力,通过像素颜色混合功能实现作用力的累加,利用GPU自动生成MipMap的能力计算所有个体的平均速度和平均位置。实验结果表明,该方法能够有效提高大规模群体运动的渲染速度。
Crowds simulation has a wide range of applications in the fields such as virtual reality,film animation,computer game and so on. In the simulation of massive crowds,each individual must interact with other individuals within the range of its perception. The upda-ting of all individuals' velocities and positions result in a O( N2 ) computation. Present a GPU based implementation of BOIDS flock al-gorithm to solve the problem mentioned before. The implementation takes full advantage of parallel computing of GPU to overcome the huge computational cost in massive crowds' animation. The approach mentioned in this paper makes full use of the fast rasterization capa-bility of GPU to compute the force between each individual and its neighbor,the pixel color blending capability to accumulate the force, generating the MipMap capability to get the average velocity and average position of all individuals. Experimental results indicate that this method can improve the speed and efficiency of rendering in the simulation of large-scale crowds.