diff --git a/src/rendering/hwrenderer/postprocessing/hw_postprocess.cpp b/src/rendering/hwrenderer/postprocessing/hw_postprocess.cpp index 37db55ce9..eedf9a6d2 100644 --- a/src/rendering/hwrenderer/postprocessing/hw_postprocess.cpp +++ b/src/rendering/hwrenderer/postprocessing/hw_postprocess.cpp @@ -706,6 +706,7 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW combineUniforms.SampleCount = gl_multisample; combineUniforms.Scale = screen->SceneScale(); combineUniforms.Offset = screen->SceneOffset(); + combineUniforms.DebugMode = gl_ssao_debug; IntRect ambientViewport; ambientViewport.left = 0; @@ -759,7 +760,10 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW renderstate->Shader = gl_multisample > 1 ? &CombineMS : &Combine; renderstate->Uniforms.Set(combineUniforms); renderstate->Viewport = screen->mSceneViewport; - renderstate->SetInputTexture(0, &Ambient0, PPFilterMode::Linear); + if (gl_ssao_debug < 3) + renderstate->SetInputTexture(0, &Ambient0, PPFilterMode::Linear); + else + renderstate->SetInputSceneNormal(0, PPFilterMode::Linear); renderstate->SetInputSceneFog(1); renderstate->SetOutputSceneColor(); if (gl_ssao_debug != 0) diff --git a/src/rendering/hwrenderer/postprocessing/hw_postprocess.h b/src/rendering/hwrenderer/postprocessing/hw_postprocess.h index c867d4ba3..fca4ec77b 100644 --- a/src/rendering/hwrenderer/postprocessing/hw_postprocess.h +++ b/src/rendering/hwrenderer/postprocessing/hw_postprocess.h @@ -650,7 +650,7 @@ struct DepthBlurUniforms struct AmbientCombineUniforms { int SampleCount; - int Padding0, Padding1, Padding2; + int DebugMode, Padding1, Padding2; FVector2 Scale; FVector2 Offset; @@ -659,7 +659,7 @@ struct AmbientCombineUniforms return { { "SampleCount", UniformType::Int, offsetof(AmbientCombineUniforms, SampleCount) }, - { "Padding0", UniformType::Int, offsetof(AmbientCombineUniforms, Padding0) }, + { "DebugMode", UniformType::Int, offsetof(AmbientCombineUniforms, DebugMode) }, { "Padding1", UniformType::Int, offsetof(AmbientCombineUniforms, Padding1) }, { "Padding2", UniformType::Int, offsetof(AmbientCombineUniforms, Padding2) }, { "Scale", UniformType::Vec2, offsetof(AmbientCombineUniforms, Scale) }, diff --git a/wadsrc/static/shaders/glsl/ssaocombine.fp b/wadsrc/static/shaders/glsl/ssaocombine.fp index f97bb31a6..ab2deff7f 100644 --- a/wadsrc/static/shaders/glsl/ssaocombine.fp +++ b/wadsrc/static/shaders/glsl/ssaocombine.fp @@ -30,6 +30,13 @@ void main() vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb; #endif - float attenutation = texture(AODepthTexture, TexCoord).x; - FragColor = vec4(fogColor, 1.0 - attenutation); + vec4 ssao = texture(AODepthTexture, TexCoord); + float attenutation = ssao.x; + + if (DebugMode == 0) + FragColor = vec4(fogColor, 1.0 - attenutation); + else if (DebugMode < 3) + FragColor = vec4(attenutation, attenutation, attenutation, 1.0); + else + FragColor = vec4(ssao.xyz, 1.0); }