您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
67 行
1.9 KiB
67 行
1.9 KiB
Shader "Hidden/Universal Render Pipeline/Blit"
|
|
{
|
|
SubShader
|
|
{
|
|
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline"}
|
|
LOD 100
|
|
|
|
Pass
|
|
{
|
|
Name "Blit"
|
|
ZTest Always
|
|
ZWrite Off
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma vertex Vertex
|
|
#pragma fragment Fragment
|
|
|
|
#pragma multi_compile _ _LINEAR_TO_SRGB_CONVERSION
|
|
#pragma multi_compile _ _KILL_ALPHA
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#ifdef _LINEAR_TO_SRGB_CONVERSION
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#endif
|
|
|
|
struct Attributes
|
|
{
|
|
float4 positionOS : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
half4 positionCS : SV_POSITION;
|
|
half2 uv : TEXCOORD0;
|
|
};
|
|
|
|
TEXTURE2D(_BlitTex);
|
|
SAMPLER(sampler_BlitTex);
|
|
|
|
Varyings Vertex(Attributes input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
|
output.uv = input.uv;
|
|
return output;
|
|
}
|
|
|
|
half4 Fragment(Varyings input) : SV_Target
|
|
{
|
|
half4 col = SAMPLE_TEXTURE2D(_BlitTex, sampler_BlitTex, input.uv);
|
|
#ifdef _LINEAR_TO_SRGB_CONVERSION
|
|
col = LinearToSRGB(col);
|
|
#endif
|
|
#ifdef _KILL_ALPHA
|
|
col.a = 1.0;
|
|
#endif
|
|
return col;
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|