Z pre-pass

In the rendering Process, the first pass render to a depth buffer to get the front layer of depth. Next, we use this depth layer to cull the objects behind where a lot of draws are omitted.

This technique works well when we render transparent objects. The disordered internal structure of the transparent objects will not appear, due to the depth culling.

Actually, the efficiency of z pre-pass seems not quite optimistic.

http://casual-effects.blogspot.hk/2013/08/z-prepass-considered-irrelevant.html

http://www.gamedev.net/topic/641257-depth-pre-pass-worth-it/

These two authors have test the performance with or without z pre-pass. The conclusion is that  there was no efficiency improvement.

The saving cost of overshadeing in second pass pays the cost of transformation, tessellation and rasterizer setup in first pass.

I think this may be the right reason AC2 cut z pre-pass off, but it will lead to transparent objects rendering order issues.

front-to-back

Render the opaque objects from front to back, so that the objects obscured will be culled from the front surface by depth test. The efficiency will be improved.

Pack multiple batches together

Submit draw calls of the same render sates one time instead of small batchs many times.

https://www.nvidia.com/docs/IO/8228/BatchBatchBatch.pdf

(This document from Nvidia has detailed explanation of batch. It is a CPU bottleneck, not GPU. Show me many new opinions even conflict with my ideas before. Now I am not very confidence with my opinion about pack batches. )

But there is a contradiction between front-to-back and pack batches of the same rendering state. We want to render some grass located everywhere around the scene, for example. If render them from front to back strictly,

will lead to switch render states repeatedly and you could not merge  batches.

In response to this question, Zhangxiaoyu and Chenzhe discussed the idea that if you do a z pre-pass, you do not need front-to-back, so you could pack batches.

We all agreed. But then I read those above two articles aware of the following questions:

1. At the first pass of z pre-pass, if we use front-to-back, efficiency improved.  This is have been neglecting during the discussion. Z pre-pass and front-to-back are not mutually exclusive.

2.The discussion ignores the cost of z pre-pass in the first pass from vertex shader to rasterize. Although there won’t be any ps, go to the rasterization cost a lot, from the two tests above.

In summary, z pre-pass plus pack batches is not optimistic. I will test by myself after my deferred and forward demos established to get a further insight.

Quoted from Morgan McGuire(the author of G3D):

In other words, the z-prepass may be irrelevant in modern rendering systems that submit many draw calls for well-sorted objects,

and is potentially harmful as tessellation (and thus rasterizer setup) and skinning workloads increase.

Discussion about z pre-pass的更多相关文章

  1. Tile based Rendering 二 tbr and tbdr 优化建议tiled based deferred rendering

    http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-TileBasedArchitectures.pdf tbr 和tbdr ...

  2. 深入剖析GPU Early Z优化

    最近在公司群里同事发了一个UE4关于Mask材质的优化,比如在场景中有大面积的草和树的时候,可以在很大程度上提高效率.这其中的原理就是利用了GPU的特性Early Z,但是它的做法跟我最开始的理解有些 ...

  3. Python 3 条件、循环和assert、pass、del

    条件: if 条件:     语句块 elif:     语句块 else:     语句块 elif 表示 else if 这居然是合法的!!!1 < x < 2!!! >> ...

  4. hdu4939 Stupid Tower Defense (DP)

    2014多校7 第二水的题 4939 Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131 ...

  5. 引擎设计跟踪(九.14.3) deferred shading 准备

    目前做的一些准备工作 1.depth prepass for forward shading. 做depth prepass的原因是为了完善渲染流程, 虽然架构上支持多个pass, 但实际上从来没有测 ...

  6. 引擎设计跟踪(九.14.2 final) Inverse Kinematics: CCD 在Blade中的实现

    因为工作忙, 好久没有记笔记了, 但是有时候发现还得翻以前的笔记去看, 所以还是尽量记下来备忘. 关于IK, 读了一些paper, 觉得之前翻译的那篇, welman的paper (http://gr ...

  7. 常用工具类——StringUtils

    /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreem ...

  8. 使用flink Table &Sql api来构建批量和流式应用(2)Table API概述

    从flink的官方文档,我们知道flink的编程模型分为四层,sql层是最高层的api,Table api是中间层,DataStream/DataSet Api 是核心,stateful Stream ...

  9. shell 条件测试

    1.文件相关 -e 判断文件或者文件夹是否存在 -d 判断目录是否存在 -f 判断文件是否存在 -r 判断是否有读权限 -w 判断是否有写权限 -x 判断是否有执行权限 1.1命令行使用 [root@ ...

随机推荐

  1. jmeter快捷键

    快捷键 功能 备注 Ctrl + C 复制 可复制组件 Ctrl + V 粘贴 可粘贴组件 Ctrl + Shift + C 复制粘贴当前组件到下一行   Ctrl + R 运行测试计划   Ctrl ...

  2. python 学习分享-面向对象2

    面向对象进阶 静态方法 一种普通函数,就位于类定义的命名空间中,它不会对任何实例类型进行操作.使用装饰器@staticmethod定义静态方法.类对象和实例都可以调用静态方法: class Foo: ...

  3. Leetcode 645.最长数对链

    最长数对链 给出 n 个数对. 在每一个数对中,第一个数字总是比第二个数字小. 现在,我们定义一种跟随关系,当且仅当 b < c 时,数对(c, d) 才可以跟在 (a, b) 后面.我们用这种 ...

  4. [问题解决]NotImplementedError 错误原因:子类没有实现父类要求一定要实现的接口

    NotImplementedError: 子类没有实现父类要求一定要实现的接口. 在面向对象编程中,父类中可以预留一个接口不实现,要求在子类中实现.如果一定要子类中实现该方法,可以使用raise No ...

  5. mybatis经验

  6. vue-cli 脚手架分析

    Vue-cli 一.安装vue-cli 安装vue-cli的前提是你已经安装了npm,安装npm你可以直接下载node的安装包进行安装.你可以在命令行工具里输入npm -v  检测你是否安装了npm和 ...

  7. POJ2749 Building roads 【2-sat】

    题目 Farmer John's farm has N barns, and there are some cows that live in each barn. The cows like to ...

  8. Gym 100971B 水&愚

    Description standard input/output Announcement   Statements A permutation of n numbers is a sequence ...

  9. This dependency was not found: * !!vue-style-loader!css-loader? 解决方案

    但是当你新建一个vue项目时,需要重新安装stylus,否则报错: This dependency was not found: * !!vue-style-loader!css-loader?{&q ...

  10. C 语言实现 php base64_encode

    这是在网上找到的一段代码,因为需求不同,稍微做了下修改,有需要的朋友可以直接复制使用. unsigned char *base64_encode(const unsigned char *str, s ...