UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl
2024-10-27 10:53:47 +03:00

27 lines
584 B
HLSL

#ifndef UNIVERSAL_PIPELINE_LODCROSSFADE_INCLUDED
#define UNIVERSAL_PIPELINE_LODCROSSFADE_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GlobalSamplers.hlsl"
float _DitheringTextureInvSize;
TEXTURE2D(_DitheringTexture);
half CopySign(half x, half s)
{
return (s >= 0) ? abs(x) : -abs(x);
}
void LODFadeCrossFade(float4 positionCS)
{
half2 uv = positionCS.xy * _DitheringTextureInvSize;
half d = SAMPLE_TEXTURE2D(_DitheringTexture, sampler_PointRepeat, uv).a;
d = unity_LODFade.x - CopySign(d, unity_LODFade.x);
clip(d);
}
#endif