Unity Web Shader IDE
Full source <URP>/ShaderLibrary/LODCrossFade.hlsl HLSL 27 lines 10 symbols 1 includes Hide source Show source
LODCrossFade.hlsl <URP>/ShaderLibrary/LODCrossFade.hlsl
Language
HLSL
Lines
27
Symbols
10
Includes
1
Open IDE root

<URP>/ShaderLibrary/LODCrossFade.hlsl full source

#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