mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
Removed normal from bilateral blur... again
This commit is contained in:
parent
d5d0f056a9
commit
64b72e3538
2 changed files with 4 additions and 11 deletions
|
@ -508,7 +508,6 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
|||
auto occlusionNormalFramebuffer = _framebuffer->getNormalFramebuffer(resolutionLevel);
|
||||
auto occlusionNormalTexture = _framebuffer->getNormalTexture(resolutionLevel);
|
||||
#endif
|
||||
auto fullNormalTexture = linearDepthFramebuffer->getNormalTexture();
|
||||
|
||||
// Update sample rotation
|
||||
const int SSAO_RANDOM_SAMPLE_COUNT = int(_randomSamples.size() / SSAO_SPLIT_COUNT);
|
||||
|
@ -620,7 +619,6 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
|||
batch.setFramebuffer(occlusionBlurredFBO);
|
||||
// Use full resolution depth and normal for bilateral upscaling and blur
|
||||
batch.setResourceTexture(render_utils::slot::texture::SsaoDepth, linearDepthTexture);
|
||||
batch.setResourceTexture(render_utils::slot::texture::SsaoNormal, fullNormalTexture);
|
||||
batch.setUniformBuffer(render_utils::slot::buffer::SsaoBlurParams, _hblurParametersBuffer);
|
||||
batch.setPipeline(firstHBlurPipeline);
|
||||
batch.setResourceTexture(render_utils::slot::texture::SsaoOcclusion, occlusionFBO->getRenderBuffer(0));
|
||||
|
|
|
@ -401,9 +401,8 @@ float fetchOcclusion(vec2 coords) {
|
|||
}
|
||||
|
||||
const float BLUR_EDGE_DISTANCE_SCALE = 300.0;
|
||||
const float BLUR_EDGE_NORMAL_SCALE = 0.5;
|
||||
|
||||
vec2 evalTapWeightedValue(ivec3 side, int r, ivec2 destPixelCoord, vec2 scaledTexCoord, vec2 fullTexCoord, float fragDepth, vec3 fragNormal) {
|
||||
vec2 evalTapWeightedValue(ivec3 side, int r, ivec2 destPixelCoord, vec2 scaledTexCoord, vec2 fullTexCoord, float fragDepth) {
|
||||
ivec2 tapOffset = <$axis$> * r;
|
||||
ivec2 tapPixelCoord = destPixelCoord + ivec2(tapOffset);
|
||||
|
||||
|
@ -416,14 +415,11 @@ vec2 evalTapWeightedValue(ivec3 side, int r, ivec2 destPixelCoord, vec2 scaledTe
|
|||
|
||||
tapTexCoord = fullTexCoord + tapOffset * getDepthBlurScale();
|
||||
float tapDepth = getZEyeAtUV(tapTexCoord, 0);
|
||||
vec3 tapNormal = getNormalEyeAtUV(tapTexCoord, 0);
|
||||
float weight = getBlurCoef(abs(r));
|
||||
|
||||
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
|
||||
float zDistance = tapDepth - fragDepth;
|
||||
tapNormal -= fragNormal;
|
||||
float normalDistance = dot(tapNormal,tapNormal);
|
||||
weight *= exp(-getBlurEdgeSharpness() * (zDistance * zDistance * BLUR_EDGE_DISTANCE_SCALE + normalDistance * BLUR_EDGE_NORMAL_SCALE));
|
||||
weight *= exp(-getBlurEdgeSharpness() * (zDistance * zDistance * BLUR_EDGE_DISTANCE_SCALE));
|
||||
|
||||
return vec2(tapOcclusion * weight, weight);
|
||||
}
|
||||
|
@ -433,7 +429,6 @@ vec3 getBlurredOcclusion(ivec2 destPixelCoord, vec2 scaledTexCoord, vec2 fullTex
|
|||
ivec4 side = getStereoSideInfo(destPixelCoord.x, 0);
|
||||
|
||||
float fragDepth = getZEyeAtUV(fullTexCoord, 0);
|
||||
vec3 fragNormal = getNormalEyeAtUV(fullTexCoord, 0);
|
||||
vec2 weightedSums = vec2(0.0);
|
||||
|
||||
// Accumulate weighted contributions along the bluring axis in the [-radius, radius] range
|
||||
|
@ -441,7 +436,7 @@ vec3 getBlurredOcclusion(ivec2 destPixelCoord, vec2 scaledTexCoord, vec2 fullTex
|
|||
|
||||
// negative side first
|
||||
for (int r = -blurRadius; r <= -1; ++r) {
|
||||
weightedSums += evalTapWeightedValue(side.xyz, r, destPixelCoord, scaledTexCoord, fullTexCoord, fragDepth, fragNormal);
|
||||
weightedSums += evalTapWeightedValue(side.xyz, r, destPixelCoord, scaledTexCoord, fullTexCoord, fragDepth);
|
||||
}
|
||||
|
||||
// Central pixel contribution
|
||||
|
@ -451,7 +446,7 @@ vec3 getBlurredOcclusion(ivec2 destPixelCoord, vec2 scaledTexCoord, vec2 fullTex
|
|||
|
||||
// then positive side
|
||||
for (int r = 1; r <= blurRadius; ++r) {
|
||||
weightedSums += evalTapWeightedValue(side.xyz, r, destPixelCoord, scaledTexCoord, fullTexCoord, fragDepth, fragNormal);
|
||||
weightedSums += evalTapWeightedValue(side.xyz, r, destPixelCoord, scaledTexCoord, fullTexCoord, fragDepth);
|
||||
}
|
||||
|
||||
// Final normalization
|
||||
|
|
Loading…
Reference in a new issue