::I am using Unity version 2022.3.17 and I have been implementing a top down underwater survival game. I wished to use your underwater effect to achieve the desired aesthetic. I have followed the section of part 10 that addresses the water effect and have found that the shader texture is pink and seems to be having some kind of error the issue only appears when I change the return lerp in the shader from:
(col, _DepthColor, depth)
To:
(col, (0.5 * ambient + _DepthColor * 0.5) * ambient.w, depth)
for context here is the segment of code from the shader:
//frag function (ran on every pixel seen by camerea and where post processing effects are applied)
fixed4 frag (v2f i) : SV_Target
{
//sample all pixels in i.screenPos from the _CameraDepthTexture, then convert to //linear depth (typical depth is non linear) then clamp between zero and 1
float depth = LinearEyeDepth(tex2D(_CameraDepthTexture, i.screenPos.xy));
//clip the depth between 0 and 1 where 1 is if a pixel is further then depth End
depth = saturate((depth - _DepthStart) / _DepthEnd);
//scale intensity of blue based on depth value lerp
fixed4 col = tex2D(_MainTex, i.screenPos);
return lerp(col, (0.5 * ambient + _DepthColor * 0.5) * ambient.w, depth);
}
and here is a screenshot of my game when playing in the unity editor I have included the Main Camera subwindow so you can see the intended view.
View post on imgur.com