UE4MaskGPUEarly ZEarly ZGPUEarly ZEarly ZUE4Early Z OverdrawEarly ZEarly Z
Early-z(GPU Programming Guide Version 2.5.0 (GeForce 7 and earlier GPUs))[ii] optimization (sometimes called z-cull) improves performance by avoiding the rendering of occluded surfaces. If the occluded surfaces have expensive shaders applied to them, z-cull can save a large amount of
NVIDIA GeForce 6 series and later GPUs can perform a coarse level Z and Stencil culling. Thanks to this optimization large blocks of pixels will not be scheduled for pixel shading if they are determined to be definitely occluded. In addition, GeForce 8 series and later GPUs can also perform fine-grained Z and Stencil culling, which allow the GPU to skip the shading of occluded pixels. These hardware optimizations are automatically enabled when possible, so they are mostly transparent to developers. However, it is good to know when they cannot be enabled or when they can underperform to ensure that you are taking advantage of them.
1. If the depth buffer was written using a different depth test direction than that used for testing 2. If the depth of the scene contains a lot of high frequency information (i.e.: the depth varies a lot within a few pixels)
Hierarchical Z, or HiZ for short, allows tiles of pixels to be rejected in a hierarchical fashion. This allows for faster rejection of occluded pixels and offers some bandwidth saving by doing a rough depth test using lower resolution buffers first instead of reading individual depth samples. Tiles that can safely be discarded are eliminated and thus the fragment 1 shader will not be executed for those pixels. Tiles that cannot safely be discarded are passed on to the Early Z stage, which will be discussed later on.
The Early Z component operates on a pixel level and allows fragments to be rejected before executing the fragment shader. This means that if a certain fragment is found to be occluded by the current contents of the depth buffer, the fragment shader doesnt have to run for that pixel. Early Z can also reject fragments before shading based on the stencil test. On hardware prior to the Radeon HD 2000 series, early Z was a monolithic top-of-the-pipe operation, which means that the entire read-modify- write cycle is executed before the fragment shader. As a result this impacts other functionality that kills fragments such as alpha test and texkill (called clip in HLSL and discard in GLSL). If Early Z would be left on and the alpha test kills a fragment, the depth- and/or stencil-buffer would have been incorrectly updated for the killed fragments. Therefore, Early Z is disabled for these cases. However, if depth and stencil writes are disabled there are no updates to the depth-stencil buffer anyway, so in this case Early Z will be enabled. On the Radeon HD 2000 series, Early Z works in all cases.
MaskPSMaskMaskUE4EqualclipnVidia GTX 570GPA(intel graphics performance analyzer)PSPixel:
[i] https://en.wikipedia.org/wiki/Graphics_pipeline [ii]http://developer.download.nvidia.com/GPU_Programming_Guide/GPU_Programming_Guide.pdf [iii]http://developer.download.nvidia.com/GPU_Programming_Guide/GPU_Programming_Guide_G80.pdf [iv]http://webcache.googleusercontent.com/search?q=cache:koTtY0dQ5NQJ:swiborg.com/download/dev/pdf/(amd)-depth-in-depth.pdf+&cd=11&hl=en&ct=clnk&gl=us [v] https://www.slideshare.net/EpicGamesJapan/mask-material-only-in-early-zpass [vi] http://www.rastertek.com/dx11tut05.html [vii] https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/sm5-attributes-earlydepthstencil