浏览代码

Pass Z-buffer parameters to LinearEyeDepth()

/main
Evgenii Golubev 8 年前
当前提交
fabf3afc
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 10
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/AtmosphericScattering.hlsl

10
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/AtmosphericScattering.hlsl


float4 baseUV = float4(uv.x, uv.y, 0.f, 0.f);
float cDepth = SAMPLE_TEXTURE2D_LOD(_CameraDepthTexture, SRL_BilinearSampler, baseUV, 0.f).r;
cDepth = LinearEyeDepth(cDepth);
cDepth = LinearEyeDepth(cDepth, _ZBufferParams);
float4 xDepth;
baseUV.xy = uv + _DepthTextureScaledTexelSize.zy; xDepth.x = SAMPLE_TEXTURE2D_LOD(_CameraDepthTexture, SRL_BilinearSampler, baseUV);

xDepth.x = LinearEyeDepth(xDepth.x);
xDepth.y = LinearEyeDepth(xDepth.y);
xDepth.z = LinearEyeDepth(xDepth.z);
xDepth.w = LinearEyeDepth(xDepth.w);
xDepth.x = LinearEyeDepth(xDepth.x, _ZBufferParams);
xDepth.y = LinearEyeDepth(xDepth.y, _ZBufferParams);
xDepth.z = LinearEyeDepth(xDepth.z, _ZBufferParams);
xDepth.w = LinearEyeDepth(xDepth.w, _ZBufferParams);
float4 diffDepth = xDepth - cDepth.rrrr;
float4 maskDepth = abs(diffDepth) < _OcclusionDepthThreshold;

正在加载...
取消
保存