unity, shader中获得当前像素深度

frag shader中直接访问i.pos.z就是深度,不必除以i.pos.w,因为系统已经自动进行过了透视除法且已将i.pos.w置为0。

原文地址:https://www.cnblogs.com/wantnon/p/6919073.html