Rasagar/Library/PackageCache/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl

27 lines
584 B
HLSL
Raw Normal View History

2024-08-26 13:07:20 -07:00
#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