Difference between revisions of "GPU Instancer:Terminology"
GurBu Admin (talk | contribs) (→Occlusion Culling) |
GurBu Admin (talk | contribs) (→Occlusion Culling) |
||
Line 37: | Line 37: | ||
|| | || | ||
− | In most games, the camera is dynamic - it | + | In most games, the camera is dynamic - it captures the game world from different angles. So for example in one camera position, the grass behind a house can be visible - and yet in another one it may not. However, with only [[GPU_Instancer:Terminology#Frustum_Culling|frustum culling]], the grass will be rendered as long as it stays inside the camera frustum - even though it may actually be hidden behind the house. This happens because objects are drawn from farthest first to closest last in Unity (and 3D graphics in general). The closer ones are thus drawn on top of the farther ones. This is referred to as '''overdraw'''. |
Line 43: | Line 43: | ||
+ | As opposed to [[GPU_Instancer:Terminology#Frustum_Culling|frustum culling]], occlusion culling does not happen automatically in Unity. For an overview of the Unity's default occlusion culling solution, you can take a look at this link: | ||
+ | |||
+ | https://docs.unity3d.com/Manual/OcclusionCulling.html | ||
+ | |||
+ | |||
+ | This solution has two major drawbacks: '''(a)''' You need to prepare (bake) your scene's occlusion data before using it and '''(b)''' you need your occluding geometry to be static to be able to do so. That effectively means that objects that move during playtime cannot be used for occlusion culling. | ||
+ | |||
+ | |||
+ | GPUI offers | ||
Revision as of 19:16, 1 December 2018
About | Features | Getting Started | Terminology | Best Practices | F.A.Q.
Terminology
Contents
[hide]GPU Instancing
Compute Shaders
Frustum Culling
Without any culling, the graphics card would render everything in the scene; whether the rendered objects are actually visible or not. Given that the more geometry the graphics card renders, the slower it will be rendering them, various techniques are used not to render the unnecessary geometry. "Culling" is a term that is used when some objects are decided not to be rendered based on a rule.
|
Occlusion Culling
In most games, the camera is dynamic - it captures the game world from different angles. So for example in one camera position, the grass behind a house can be visible - and yet in another one it may not. However, with only frustum culling, the grass will be rendered as long as it stays inside the camera frustum - even though it may actually be hidden behind the house. This happens because objects are drawn from farthest first to closest last in Unity (and 3D graphics in general). The closer ones are thus drawn on top of the farther ones. This is referred to as overdraw.
https://docs.unity3d.com/Manual/OcclusionCulling.html
|
How does Hi-Z Occlusion Culling work?
In occlusion culling (in general), the most important idea is to never cull visible objects. After this, the second-most important idea is to cull fast. GPUI's culling algorithm makes the camera generate a depth texture and use this to make culling decisions in the compute shaders. There are various advantages of this (e.g. you don't need to bake occlusion maps, can use culling with dynamic occluders, etc.) and it is extremely fast since all the operations are executed in the GPU. However, the culling accuracy is ultimately limited by the precision of the depth buffer. On this point, GPUI analyzes the depth texture, and decides how accurate it can be without compromising performance and culling actually visible instances.
As you can see in the images below, the depth texture is a grayscale representation of the camera view where white is close to the camera and black is away.
As the distance between the occluder and the instances become shorter with respect to the distance from the camera, their depth representation become closer to the same color:
In short, given the precision of the depth buffer, GPUI makes the best choice to cull instances for better performance - but also without any chance to cull any visible objects.