Commit f179d7ac authored by Dario Seyb's avatar Dario Seyb

disabled SSAO again

parent d0dd31f5
......@@ -16,7 +16,7 @@ uniform float uTime;
uniform float uNoiseScale = 0.002;
uniform int uSampleKernelSize = 16;
uniform float uRadius = 0.025;
uniform float uRadius = 0.05;
in vec2 vTexCoord;
......@@ -36,9 +36,11 @@ float linearizeDepth(float depth) {
}
void main() {
vec3 origin = unpackWorldPosition(texture(uSamplerDepth, vTexCoord).r);
vec3 normal = normalize((transpose(uViewInverseMatrix) *
vec4(unpackNormal(texture(uSamplerNormalMotion, vTexCoord)), 0)).xyz);
float originDepth = texture(uSamplerDepth, vTexCoord).r;
vec3 origin = unpackWorldPosition(originDepth);
vec3 normal = unpackNormal(texture(uSamplerNormalMotion, vTexCoord));
normal = normalize( (transpose(uViewInverseMatrix) * vec4(normal, 0)).xyz );
vec3 rvec = texture(uSamplerNoise, vTexCoord * uNoiseScale).xyz * 2.0 - 1.0;
vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
......@@ -54,15 +56,14 @@ void main() {
offset = uViewProjectionMatrix * offset;
offset.xy /= offset.w;
offset.xy = offset.xy * 0.5 + 0.5;
// get sample depth:
vec3 samplePos = unpackWorldPosition(texture(uSamplerDepth, offset.xy).r);
float sampleDepth = texture(uSamplerDepth, offset.xy).r;
vec3 samplePos = unpackWorldPosition(sampleDepth);
// range check & accumulate:
float rangeCheck= length(samplePos-origin) > uRadius ? 1.0 : 0.0;
occlusion += (samplePos.z >= sample.z ? 1.0 : 0.0) * rangeCheck ;
occlusion += ( originDepth >= sampleDepth ? 1.0 : 0.0) * rangeCheck;
}
occlusion = 1.0 - (occlusion / uSampleKernelSize);
......
......@@ -81,7 +81,7 @@ bool AtmosphereTestScene::startup() {
m_renderer->setRenderPassActive("Skybox"_sh, false);
m_renderer->setRenderPassActive("Minimap"_sh, false);
m_renderer->setRenderPassSSAO("Cockpit"_sh, true);
m_renderer->setRenderPassSSAO("Cockpit"_sh, false);
m_renderer->addRenderPass(consoleCamera, "Console"_sh, ScreenSpaceSize::HALF);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment