Created
January 28, 2024 14:44
-
-
Save EricHu33/0e78a38e2d92d83b7ef6654c1b7f6774 to your computer and use it in GitHub Desktop.
Custom Shader code for URP's Full Screen Pass Renderer Feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sample code of custom shader that using unity's blit texture(from Blit.hlsl) so this shader is same as a posteffect shadergraph code. | |
//and can be use in the urp's built in Full Screen Pass Renderer Feature(unity 2022+) | |
Shader "ColorBlit" | |
{ | |
Properties | |
{ | |
_Intensity("_Intensity", Range(0,1)) = 0 | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"} | |
LOD 100 | |
ZWrite Off Cull Off | |
Pass | |
{ | |
Name "ColorBlitPass" | |
HLSLPROGRAM | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | |
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl" | |
#pragma vertex Vert | |
#pragma fragment frag | |
float _Intensity; | |
half4 frag (Varyings input) : SV_Target | |
{ | |
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); | |
float4 color = SAMPLE_TEXTURE2D(_BlitTexture, sampler_PointClamp, input.texcoord); | |
return lerp(color, 1-color, _Intensity); | |
} | |
ENDHLSL | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment