You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <scenesrg.srgi>
|
|
#include <viewsrg.srgi>
|
|
|
|
#include <Atom/Features/PostProcessing/FullscreenVertexUtil.azsli>
|
|
#include <Atom/Features/PostProcessing/FullscreenVertexInfo.azsli>
|
|
#include <Atom/Features/PostProcessing/FullscreenPixelInfo.azsli>
|
|
#include <Atom/Features/PBR/LightingUtils.azsli>
|
|
#include <Atom/RPI/Math.azsli>
|
|
|
|
ShaderResourceGroup PassSrg : SRG_PerPass
|
|
{
|
|
Texture2D<float4> m_visualization;
|
|
Texture2D<float> m_depth;
|
|
|
|
Sampler LinearSampler
|
|
{
|
|
MinFilter = Linear;
|
|
MagFilter = Linear;
|
|
MipFilter = Linear;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
AddressW = Clamp;
|
|
};
|
|
}
|
|
|
|
// Vertex Shader
|
|
VSOutput MainVS(VSInput input)
|
|
{
|
|
VSOutput OUT;
|
|
|
|
float4 posTex = GetVertexPositionAndTexCoords(input.m_vertexID);
|
|
OUT.m_position = float4(posTex.x, posTex.y, 0.0, 1.0);
|
|
|
|
return OUT;
|
|
}
|
|
|
|
// Pixel Shader
|
|
PSOutput MainPS(VSOutput IN)
|
|
{
|
|
uint2 screenCoords = IN.m_position.xy;
|
|
float depth = PassSrg::m_depth.Load(uint3(screenCoords, 0)).r;
|
|
float4 visualization = PassSrg::m_visualization.Load(uint3(screenCoords, 0));
|
|
|
|
if (!any(visualization))
|
|
{
|
|
discard;
|
|
}
|
|
|
|
if (depth > visualization.a)
|
|
{
|
|
discard;
|
|
}
|
|
|
|
PSOutput OUT;
|
|
OUT.m_color = float4(visualization.rgb, 1.0f);
|
|
return OUT;
|
|
}
|