SpriteUnlitPass.hlsl 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. #if ETC1_EXTERNAL_ALPHA
  2. TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex);
  3. float _EnableAlphaTexture;
  4. #endif
  5. float4 _RendererColor;
  6. PackedVaryings vert(Attributes input)
  7. {
  8. Varyings output = (Varyings)0;
  9. output = BuildVaryings(input);
  10. PackedVaryings packedOutput = PackVaryings(output);
  11. return packedOutput;
  12. }
  13. half4 frag(PackedVaryings packedInput) : SV_TARGET
  14. {
  15. Varyings unpacked = UnpackVaryings(packedInput);
  16. UNITY_SETUP_INSTANCE_ID(unpacked);
  17. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
  18. SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(unpacked);
  19. SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
  20. #if ETC1_EXTERNAL_ALPHA
  21. float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, unpacked.texCoord0.xy);
  22. surfaceDescription.Color.a = lerp (surfaceDescription.Color.a, alpha.r, _EnableAlphaTexture);
  23. #endif
  24. surfaceDescription.Color *= unpacked.color;
  25. return surfaceDescription.Color;
  26. }