EditorModeTint.azsl 1.0 KB

123456789101112131415161718192021222324252627282930
  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 <EditorModeCommon.azsli>
  9. PSOutput MainPS(VSOutput IN)
  10. {
  11. PSOutput OUT;
  12. const float3 inColor = PassSrg::m_framebuffer.Sample(PassSrg::LinearSampler, IN.m_texCoord).rgb;
  13. const float mask = PassSrg::m_entityMask.Sample(PassSrg::PointSampler, IN.m_texCoord).r;
  14. // Tint effect
  15. const float3 finalEffect = lerp(inColor, PassSrg::m_tintColor.rgb, PassSrg::m_tintAmount);
  16. // Apply the depth transition to the blend amount
  17. const float zDepth = PassSrg::m_depth.Sample(PassSrg::PointSampler, IN.m_texCoord).r;
  18. const float t = PassSrg::CalculateTransitionBlendAmountFromDepth(zDepth, mask);
  19. // Apply the visual effect to non-mask entities, leaving mask entities untouched
  20. OUT.m_color = PassSrg::CalculateFinalBlendAmountAndOutputColor(inColor, finalEffect, t);
  21. return OUT;
  22. }