u3d 3.4 in water4 the _CameraDepthTexture not use an error?

[B]half4 grabWithOffset = i.grabPassPos;// + distortOffset;[/B]

half4 rtRefractionsNoDistort = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(i.grabPassPos));

[B]half refrFix = UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(grabWithOffset)));[/B]

half4 rtRefractions = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(grabWithOffset));

if (LinearEyeDepth([B]refrFix[/B]) < i.screenPos.z) 

	//rtRefractions = rtRefractionsNoDistort;

	rtRefractions = float4(1,0,0,1);
else

	rtRefractions = float4(0,1,0,1);

half4 edgeBlendFactors = half4(1.0, 0.0, 0.0, 0.0);
half depth = UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos)));
depth = LinearEyeDepth(depth);
edgeBlendFactors = saturate(_InvFadeParemeter * (depth-i.screenPos.w));
		
half4 baseColor ;

baseColor = rtRefractions;
baseColor.a = edgeBlendFactors.x;

return baseColor;

sorry my English is poor.
Hope everyone can understand. .

It looks like you need to invert your depth texture’s Y coordinate, probably because you’re using Direct3D and anti-aliasing:

#if SHADER_API_D3D9
if (_MainTex_TexelSize.y < 0)
	uv.y = 1 - uv.y;
#endif

You are right.

But _CameraDepthTexture, does not seem so.

uniform float4 _CameraDepthTexture_TexelSize. . . error

if SHADER_API_D3D9

if (_CameraDepthTexture_TexelSize.y <0)
/ /???. Y = 1 -???. y;

endif

And I uv is float4.

half refrFix = UNITY_SAMPLE_DEPTH (tex2Dproj (_CameraDepthTexture, UNITY_PROJ_COORD (grabWithOffset)));

grabWithOffset = i.grabPassPos;

ComputeScreenAndGrabPassPos (o.pos, o.screenPos, o.grabPassPos);