加入很多新内容,这波一块交了
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
Shader "Hidden/Bansonic/GlobalAfterimage"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderPipeline" = "UniversalPipeline" }
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "GlobalAfterimage"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#pragma target 4.5
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
||||
|
||||
float _AfterimageOpacity;
|
||||
float _AfterimageScale;
|
||||
TEXTURE2D(_SnapshotTex);
|
||||
SAMPLER(sampler_SnapshotTex);
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
float2 uv = input.texcoord;
|
||||
half4 baseColor = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv);
|
||||
|
||||
float safeScale = max(_AfterimageScale, 1.0);
|
||||
float2 scaledUv = (uv - 0.5) / safeScale + 0.5;
|
||||
float inside = step(0.0, scaledUv.x) * step(0.0, scaledUv.y) * step(scaledUv.x, 1.0) * step(scaledUv.y, 1.0);
|
||||
half4 snapshot = SAMPLE_TEXTURE2D(_SnapshotTex, sampler_SnapshotTex, saturate(scaledUv));
|
||||
float alpha = saturate(_AfterimageOpacity) * inside;
|
||||
return lerp(baseColor, snapshot, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user