1234567891011121314151617181920212223242526272829303132333435 |
- Shader "BlitWithMaterial"
- {
- SubShader
- {
- Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
- ZWrite Off Cull Off
- Pass
- {
- Name "BlitWithMaterialPass"
-
- 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
-
- // Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
- float4 Frag(Varyings input) : SV_Target0
- {
- // this is needed so we account XR platform differences in how they handle texture arrays
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
-
- // sample the texture using the SAMPLE_TEXTURE2D_X_LOD
- float2 uv = input.texcoord.xy;
- half4 color = SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearRepeat, uv, _BlitMipLevel);
-
- // Modify the sampled color
- return half4(0, 1, 0, 1) * color;
- }
-
- ENDHLSL
- }
- }
- }
|