Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BlitWithMaterial.shader 1.4KB

1234567891011121314151617181920212223242526272829303132333435
  1. Shader "BlitWithMaterial"
  2. {
  3. SubShader
  4. {
  5. Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
  6. ZWrite Off Cull Off
  7. Pass
  8. {
  9. Name "BlitWithMaterialPass"
  10. HLSLPROGRAM
  11. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  12. #include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
  13. #pragma vertex Vert
  14. #pragma fragment Frag
  15. // 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.
  16. float4 Frag(Varyings input) : SV_Target0
  17. {
  18. // this is needed so we account XR platform differences in how they handle texture arrays
  19. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  20. // sample the texture using the SAMPLE_TEXTURE2D_X_LOD
  21. float2 uv = input.texcoord.xy;
  22. half4 color = SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearRepeat, uv, _BlitMipLevel);
  23. // Modify the sampled color
  24. return half4(0, 1, 0, 1) * color;
  25. }
  26. ENDHLSL
  27. }
  28. }
  29. }