105 lines
2.6 KiB
Plaintext
105 lines
2.6 KiB
Plaintext
Shader "Hidden/Enviro/BlitTroughHDRP"
|
|
{
|
|
HLSLINCLUDE
|
|
|
|
#pragma target 4.5
|
|
#pragma multi_compile __ ENVIROHDRP
|
|
|
|
#if defined (ENVIROHDRP)
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/RTUpscale.hlsl"
|
|
|
|
struct Attributes
|
|
{
|
|
uint vertexID : SV_VertexID;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
Varyings Vert(Attributes input)
|
|
{
|
|
Varyings output;
|
|
UNITY_SETUP_INSTANCE_ID(input);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
|
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
|
|
output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID);
|
|
return output;
|
|
}
|
|
|
|
// List of properties to control your post process effect
|
|
float _Intensity;
|
|
TEXTURE2D_X(_InputTexture);
|
|
|
|
float4 CustomPostProcess(Varyings input) : SV_Target
|
|
{
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
|
|
|
uint2 positionSS = input.texcoord * _ScreenSize.xy;
|
|
float3 outColor = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz;
|
|
|
|
return float4(outColor, 1);
|
|
}
|
|
#else
|
|
struct appdata
|
|
{
|
|
float4 vertex : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float2 uv : TEXCOORD0;
|
|
float4 vertex : SV_POSITION;
|
|
};
|
|
|
|
v2f Vert (appdata v)
|
|
{
|
|
v2f o;
|
|
o.vertex = v.vertex;
|
|
o.uv = v.uv;
|
|
return o;
|
|
}
|
|
|
|
sampler2D _MainTex;
|
|
|
|
float4 CustomPostProcess (v2f i) : SV_Target
|
|
{
|
|
float4 col = tex2D(_MainTex, i.uv);
|
|
// just invert the colors
|
|
col.rgb = 1 - col.rgb;
|
|
return col;
|
|
}
|
|
#endif
|
|
|
|
ENDHLSL
|
|
|
|
SubShader
|
|
{
|
|
Tags{ "RenderPipeline" = "HDRenderPipeline" }
|
|
Pass
|
|
{
|
|
Name "EnviroBlitTroughHDRP"
|
|
|
|
ZWrite Off
|
|
ZTest Always
|
|
Blend Off
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
#pragma fragment CustomPostProcess
|
|
#pragma vertex Vert
|
|
ENDHLSL
|
|
}
|
|
}
|
|
Fallback Off
|
|
}
|