MRTScreen.azsl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. ShaderResourceGroup MrtScreenInstanceSrg : SRG_PerObject
  10. {
  11. Texture2D rMap;
  12. Texture2D gMap;
  13. Texture2D bMap;
  14. Sampler m_sampler
  15. {
  16. MaxAnisotropy = 16;
  17. AddressU = Wrap;
  18. AddressV = Wrap;
  19. AddressW = Wrap;
  20. };
  21. }
  22. struct VSInput
  23. {
  24. float3 m_position : POSITION;
  25. float2 m_uv : UV0;
  26. };
  27. struct VSOutput
  28. {
  29. float4 m_position : SV_Position;
  30. float2 m_uv : UV0;
  31. };
  32. VSOutput MainVS(VSInput vsInput)
  33. {
  34. VSOutput OUT;
  35. OUT.m_position = float4(vsInput.m_position, 1.0);
  36. OUT.m_uv = vsInput.m_uv;
  37. return OUT;
  38. }
  39. struct PSOutput
  40. {
  41. float4 m_color : SV_Target0;
  42. };
  43. PSOutput MainPS(VSOutput psInput)
  44. {
  45. PSOutput OUT;
  46. float red = MrtScreenInstanceSrg::rMap.Sample(MrtScreenInstanceSrg::m_sampler, psInput.m_uv).x;
  47. float green = MrtScreenInstanceSrg::gMap.Sample(MrtScreenInstanceSrg::m_sampler, psInput.m_uv).x;
  48. float blue = MrtScreenInstanceSrg::bMap.Sample(MrtScreenInstanceSrg::m_sampler, psInput.m_uv).x;
  49. OUT.m_color = float4(red, green, blue, 1);
  50. return OUT;
  51. }