04.Rendering on Game Engine
作者:互联网
Challenges on Game Rendering
1.Tens of thousands of objects with different type of effects.
2.Deal with architecture of modern computer with complex combination of CPU and GPU
3.Commit a bullet-proof framerate
-30FPS(60FPS,120FPS+VR)
-1080p,4K and 8K resolution
4.Limit access to CPU bandwidth and memory footprint.Game logic, network, animation, physics, and AI system are major consumers of CPU and major memory
Rendering on Game Engine is a heavily optimized software framework to fulfill the critical rendering requiremennts of games on modern hardware(PC,console and mobiles)
Modern GPU architecture:
Fermi架构
sin cos等特殊运算
冯诺依曼架构,计算和数据分开。数据传输消耗很大,因此尽可能不回读数据,单向传输数据。
做一次加减乘数a+b可能只用一个clock,但是a在cache中找不到要在内存中找,这要花费一百多个clock。因此尽可能把数据放在一起,在缓存中找到了,cache hit;数据不再缓存中,cache miss。
GPU Bounds and Performance
Application performance is limited by:
-Memory Bounds
-ALU Bounds 数学运算太多了
-TMU(Texture Mapping Unit) Bound
-BW(Bandwidth) Bound
.......
Renderable
smarter way to save data:
视觉材质和物理材质是两回事
shader是源码也是数据
Render objects in Engine:
divided into submesh according to different material.But we will insert all verter into one buffer
rendering每一次为gpu设置了数据,更换数据(set pass call)并不高效,。因此可以把同material的object先绘制,更高效
尽可能一个drawcall绘制相同submesh和material的instance
Visibilty Culling
视锥外的object其实是看不见的,
要考虑动态物体结构的再构建
所谓的开放世界实际也分成了不同的zone
Texture Compression:A must-know for game engine
block-based
Authoring tools of modeling
Modeling of Polymodeling:3dmax,maya,blender
Modeling of Sculpting:Zbrush
Modeling -Scanning
Modeling -Procedural Modeling:Houdini,Unreal
Clustered-Base Mesh Pipeline:
Divide a complex mesh into a fixed-size cluster(like 32/64 triangle)
We can do culling based on mesh clusters instead of object
In UE5 Nanite:
-Hierarchical LOD clusters with seamless boundary
-Don't need hardware support, but using a hierarchical cluster culling on the precomputed BVH tree by persistent threads(CS) on GPU instead of task shader
Take Away
1.The design of game engine is deeply related to the hardware architecture design
2.A submesh design is used to support a model with multiple materials
3.Use culling algorithms to draw objects as possible
4.As GPU become more powerful, more and more work are moved into GPU, Which is called GPU Driven
标签:Engine,into,cache,Rendering,Game,GPU,Modeling,CPU 来源: https://www.cnblogs.com/pisconoob/p/16116521.html