Monochrome.azsl 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/Features/SrgSemantics.azsli>
  9. #include <Atom/Features/PostProcessing/FullscreenPixelInfo.azsli>
  10. #include <Atom/Features/PostProcessing/FullscreenVertex.azsli>
  11. #include <Atom/Features/PostProcessing/PostProcessUtil.azsli>
  12. ShaderResourceGroup PassSrg : SRG_PerPass
  13. {
  14. Texture2D<float4> m_framebuffer;
  15. Sampler LinearSampler
  16. {
  17. MinFilter = Linear;
  18. MagFilter = Linear;
  19. MipFilter = Linear;
  20. AddressU = Clamp;
  21. AddressV = Clamp;
  22. AddressW = Clamp;
  23. };
  24. float4 m_colorTint;
  25. }
  26. PSOutput MainPS(VSOutput IN)
  27. {
  28. PSOutput OUT;
  29. float3 color = PassSrg::m_framebuffer.Sample(PassSrg::LinearSampler, IN.m_texCoord).rgb;
  30. float average = color.r + color.g + color.b;
  31. average /= 3.0f;
  32. OUT.m_color.rgb = float3(average, average, average);
  33. OUT.m_color.w = 1;
  34. OUT.m_color.rgb *= PassSrg::m_colorTint.rgb;
  35. return OUT;
  36. }