Skip to content

Commit c9e9e02

Browse files
GLTF Viewer: use opacity in alpha channel
1 parent 5270a82 commit c9e9e02

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Samples/GLTFViewer/assets/shaders/ApplyPostEffects.psh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ float4 main(in FullScreenTriangleVSOutput VSOut) : SV_Target
4949

5050
float3 SSR = GetSpecularIBL_GGX(SrfInfo, IBLInfo, SSRRadiance.rgb);
5151

52-
float Opacity = 1.0 - OutColor.a;
52+
float Opacity = OutColor.a;
5353
if (DebugMode == 0.0)
5454
{
5555
OutColor.rgb += (SSR.rgb - SpecularIBL.rgb) * SSRRadiance.w * Opacity * SSRScale;
@@ -85,6 +85,5 @@ float4 main(in FullScreenTriangleVSOutput VSOut) : SV_Target
8585
}
8686
#endif
8787

88-
OutColor.a = 1.0;
8988
return OutColor;
9089
}

Samples/GLTFViewer/src/GLTFViewer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ void GLTFViewer::Render()
11621162
else
11631163
{
11641164
// Clear the back buffer
1165-
const float ClearColor[] = {0.032f, 0.032f, 0.032f, 1.0f};
1165+
const float ClearColor[] = {0.032f, 0.032f, 0.032f, 0.0f};
11661166
m_pImmediateContext->ClearRenderTarget(pRTV, ClearColor, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
11671167
m_pImmediateContext->ClearDepthStencil(pDSV, CLEAR_DEPTH_FLAG, 1.f, 0, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
11681168
}
@@ -1324,7 +1324,7 @@ void GLTFViewer::Render()
13241324
EnvMapAttribs.pEnvMap = pEnvMapSRV;
13251325
EnvMapAttribs.AverageLogLum = m_ShaderAttribs.AverageLogLum;
13261326
EnvMapAttribs.MipLevel = m_EnvMapMipLevel;
1327-
EnvMapAttribs.Alpha = 1.0;
1327+
EnvMapAttribs.Alpha = 0.0;
13281328
if ((m_RenderParams.Flags & GLTF_PBR_Renderer::PSO_FLAG_CONVERT_OUTPUT_TO_SRGB) != 0)
13291329
EnvMapAttribs.Options |= EnvMapRenderer::OPTION_FLAG_CONVERT_OUTPUT_TO_SRGB;
13301330
if (m_bEnablePostProcessing)
@@ -1394,7 +1394,7 @@ void GLTFViewer::Render()
13941394

13951395
m_pImmediateContext->SetRenderTargets(1, &pRTV, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
13961396
// Clear the back buffer
1397-
const float ClearColor[] = {0.032f, 0.032f, 0.032f, 1.0f};
1397+
const float ClearColor[] = {0.032f, 0.032f, 0.032f, 0.0f};
13981398
m_pImmediateContext->ClearRenderTarget(pRTV, ClearColor, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
13991399

14001400
m_pImmediateContext->SetPipelineState(m_ApplyPostFX.pPSO);

0 commit comments

Comments
 (0)