#if _ALPHAHOLETEXTURE TEXTURE2D(_AlphaHoleTexture); // must declare with a sampler or windows throws an error, which seems like a compiler bug float4 _AlphaHoleTexture_TexelSize; #endif void ClipWaterLevel(float3 worldPos) { clip(worldPos.y - _AlphaData.y); } void ClipAlphaHole(inout Config c, inout half4 weights) { #if _ALPHAHOLETEXTURE clip(SAMPLE_TEXTURE2D(_AlphaHoleTexture, shared_linear_clamp_sampler, c.uv).r - 0.5); #else if ((int)round(c.uv0.z ) == (int)round(_AlphaData.x)) { clip(-1); } else if ((int)round(c.uv1.z ) == (int)round(_AlphaData.x) && weights.y > 0) { weights.y = 0; weights = TotalOne(weights); } else if ((int)round(c.uv2.z ) == (int)round(_AlphaData.x) && weights.z > 0) { weights.z = 0; weights = TotalOne(weights); } else if ((int)round(c.uv3.z ) == (int)round(_AlphaData.x) && weights.w > 0) { weights.w = 0; weights = TotalOne(weights); } #endif }