EnviroBlitThroughURP.shader 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Shader "Hidden/EnviroBlitThrough"
  2. {
  3. SubShader
  4. {
  5. Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
  6. LOD 100
  7. ZTest Always ZWrite Off Cull Off
  8. Pass
  9. {
  10. Name "EnviroBlitThrough"
  11. HLSLPROGRAM
  12. #pragma vertex vert
  13. #pragma fragment frag
  14. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  15. struct Attributes
  16. {
  17. float4 positionHCS : POSITION;
  18. float2 uv : TEXCOORD0;
  19. UNITY_VERTEX_INPUT_INSTANCE_ID
  20. };
  21. struct Varyings
  22. {
  23. float4 positionCS : SV_POSITION;
  24. float2 uv : TEXCOORD0;
  25. UNITY_VERTEX_OUTPUT_STEREO
  26. };
  27. Varyings vert(Attributes input)
  28. {
  29. Varyings output;
  30. UNITY_SETUP_INSTANCE_ID(input);
  31. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  32. // Note: The pass is setup with a mesh already in CS
  33. // Therefore, we can just output vertex position
  34. // See RenderingUtils.fullscreenMesh
  35. output.positionCS = float4(input.positionHCS.xyz, 1.0);
  36. #if UNITY_UV_STARTS_AT_TOP
  37. output.positionCS.y *= -1;
  38. #endif
  39. output.uv = input.uv;
  40. return output;
  41. }
  42. TEXTURE2D_X(_MainTex);
  43. SAMPLER(sampler_MainTex);
  44. half4 frag (Varyings input) : SV_Target
  45. {
  46. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  47. return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, input.uv);
  48. }
  49. ENDHLSL
  50. }
  51. }
  52. }