Andre McGrail 3 年前
当前提交
05494bbd
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 11
      Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl

11
Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl


{
float rawD = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_ScreenTextures_linear_clamp, uvs);
float d = LinearEyeDepth(rawD, _ZBufferParams);
return float2(d * additionalData.x - additionalData.y, (rawD * -_ProjectionParams.x) + (1-UNITY_REVERSED_Z));
// TODO: Changing the usage of UNITY_REVERSED_Z this way to fix testing, but I'm not sure the original code is correct anyway.
// In OpenGL, rawD should already have be remmapped before converting depth to linear eye depth.
#if UNITY_REVERSED_Z
float offset = 0;
#else
float offset = 1;
#endif
return float2(d * additionalData.x - additionalData.y, (rawD * -_ProjectionParams.x) + offset);
}
float WaterTextureDepth(float3 posWS)

正在加载...
取消
保存