games104游戏引擎中的渲染实践

第四节:游戏引擎中的渲染实践

to-do-list:[渲染管线,mipmap,GPU Driven Rendering Pipeline,Phong模型,MVP矩阵,PVS,nanite]

渲染管线

My helpful screenshot

My helpful screenshot

My helpful screenshot

My helpful screenshot

GPU的架构

My helpful screenshot

My helpful screenshot

架构的设计:减少cpu和gpu之间的数据流动

GPU Driven Rendering Pipeline的核心思路是减少CPU和GPU之间的通信,尽量将所有渲染相关的事务(包括提交)都放在GPU端

My helpful screenshot

可渲染物体

将整个GO的纹理分为若干个submesh,每个submesh运用相关的shader和texture

My helpful screenshot

但是重复的shadeer和texture会导致内存浪费,为了实现资源共享,我们可以建立资源池

My helpful screenshot

合批处理(Batch Renderring):每次渲染同一个材质的所有物体,加快GPU处理数据的速度

My helpful screenshot

可见性裁剪

用包围盒来进行culling,同时运用BVH,八叉树等技术,讲几个包围盒作为一个整体,如果在视野范围内,向下进行查询(有点像线段树?)

My helpful screenshot

PVS(potential visibility set)的思想:在每一个房间是,最多透过窗户和门看见的区域是有限的

My helpful screenshot

Early-Z的思想:先进行深度测试,再进行渲染

My helpful screenshot

Cluster-Based Math Pipeline

在现代GPU上,我们可以根据少量的数据“凭空”生成大量的数据,如一个三角形生成一个三角形集合(曲面细分?),同时可以根据与观测者的远近来控制三角形的个数

My helpful screenshot

“Do Nothing”:通过高效的算法让计算机做尽量少的事情。