Discussion about z pre-pass

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.

时间: 2024-09-30 09:56:52

Discussion about z pre-pass的相关文章

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

条件: if 条件: 语句块 elif: 语句块 else: 语句块 elif 表示 else if 这居然是合法的!!!1 < x < 2!!! [python] view plain copy print? >>> if 1 < x < 2: print('True') True and 表示且 [python] view plain copy print? >>> if x > 1 and x < 2: print('True'

Adding a Timepicker to jQuery UI Datepicker

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="

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

因为工作忙, 好久没有记笔记了, 但是有时候发现还得翻以前的笔记去看, 所以还是尽量记下来备忘. 关于IK, 读了一些paper, 觉得之前翻译的那篇, welman的paper (http://graphics.ucsd.edu/courses/cse169_w04/welman.pdf  摘译:http://www.cnblogs.com/crazii/p/4662199.html) 非常有用, 入门必读. 入门了以后就可以结合工程来拓展了. 先贴一下CCD里面一个关节的分析: 当Pic的方

CF 269 E Flawed Flow

Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet - it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vert

常用工具类——StringUtils

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You u

关于php print_r

print_r (PHP 4, PHP 5, PHP 7) print_r - 打印关于变量的易于理解的信息. 描述? bool print_r ( mixed $expression [, bool $return ] ) Note: 参数 return 是在 PHP 4.3.0 的时候加上的 print_r() 显示关于一个变量的易于理解的信息.如果给出的是 string.integer 或 float,将打印变量值本身.如果给出的是 array,将会按照一定格式显示键和元素.object

BZOJ1166 : [Baltic2008]Magical Stones

考虑二分答案,转化为求有多少$\leq lim$的数满足条件. 从两侧往中间进行数位DP,设$f[l][r][j][x][y][z][pre][suf]$表示当前准备填的两个位置是$l$和$r$,已经有$j$对相邻的数不同,$l-1$填的是$x$,$r+1$填的是$y$,正序串和逆序串的大小关系为$z$,正序串和$lim$的大小关系为$pre$,逆序串和$lim$的大小关系为$suf$的方案数. 注意到$r=n-l+1$,因此可以省去$r$这一维,然后枚举接下来填什么数进行转移即可. 时间复杂度

Python之路【第二篇】:Python基础(一)

Python之路[第二篇]:Python基础(一) 入门知识拾遗 一.作用域 对于变量的作用域,执行声明并在内存中存在,该变量就可以在下面的代码中使用. 1 2 3 if 1==1:     name = 'wupeiqi' print  name 下面的结论对吗? 外层变量,可以被内层变量使用 内层变量,无法被外层变量使用 二.三元运算 1 result = 值1 if 条件 else 值2 如果条件为真:result = 值1如果条件为假:result = 值2 三.进制 二进制,01 八进

python之旅2

python基础 1整数 查看整数类型的方法 >>> a = 1 >>> dir(a) ['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__format__', '__getattribute__', '__getn