zoukankan      html  css  js  c++  java
  • zfighting 的问题

    1.对每个mesh 在脚本里加bias 由美术勾 {a. vertex shader b. depth bias slop depth bias rasterizateState}

    2.inverse depth

    http://outerra.blogspot.hk/2012/11/maximizing-depth-buffer-range-and.html

    https://developer.nvidia.com/content/depth-precision-visualized

    还有说什么log的depth

       gl_Position.z = 2.0*log(gl_Position.w*C + 1)/log(far*C + 1) - 1;
        gl_Position.z *= gl_Position.w;

    or
        gl_Position.z = 2.0*log(gl_Position.w/near)/log(far/near) - 1; 
        gl_Position.z *= gl_Position.w;

    3.linear depth

    -------------------------------这几天测试了下1-z 就是inverse depth 这个方法

    目前看很完美,没有引起 近处的zfighting

    我们把projectiong matrix z的部分near far交换

    避免在pix shader里修改depth 避免取消earlyz hw

    还需要在采样depth的时候用1-z

     通过在copy depth出来的时候 统一做一次1-z就能避免在每个使用depth数据的shader里1-z了 目前看比较乐观。测试版没有zfighting了

    单独把这个matrix clear 和greater equal-zfun应用于大项目的mainpass 有点困难

    ---------------

    inverse depth 作为最终版本.挨个脚本添加zbias的方法 后期不可控.工作量巨大.

    对于inverse depth在近处 观察到了 zfighting: 之前存在的近处模型的zfighting 由于inverse depth得到了解决

    但是有glowmask的地方 可能是因为太近的缘故,引起了近处的zfighting  通过对glowmask pass 单独添加bias 得到了解决

  • 相关阅读:
    大数据HIve
    大数据笔记
    [Leetcode]653.Two Sum IV
    [Leetcode]652.Find Duplicate Subtrees
    [Leetcode]650.2 Keys Keyboard
    [Leetcode]648.Replace Words
    [Leetcode Weekly Contest]173
    [总结]最短路径算法
    [Leetcode]647.Palindromic Substrings
    [Leetcode]646.Maximum Length of Pair Chain
  • 原文地址:https://www.cnblogs.com/minggoddess/p/5729570.html
Copyright © 2011-2022 走看看