From a3f1c487f1b5b3381118adb116e536e22be89f6e Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 31 Aug 2017 23:42:43 -0700 Subject: [PATCH] adding disabling of jittering for comparison --- .../render-utils/src/AntialiasingEffect.cpp | 11 +++++++---- libraries/render-utils/src/taa.slh | 9 +++++---- libraries/render-utils/src/taa_blend.slf | 1 - .../src/velocityBuffer_cameraMotion.slf | 4 ++-- .../lib/styles-uit/HifiConstants.qmlc | Bin 51304 -> 51304 bytes 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index c1d622b8de..a61b4172a0 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -458,18 +458,21 @@ void JitterSample::configure(const Config& config) { void JitterSample::run(const render::RenderContextPointer& renderContext, JitterBuffer& jitterBuffer) { auto& current = _jitterBuffer.edit().currentIndex; if (!_freeze) { - current = (current + 1) % SampleSequence::SEQUENCE_LENGTH; + if (current >= 0) { + current = (current + 1) % SampleSequence::SEQUENCE_LENGTH; + } + else { + current = -1; + } } auto viewFrustum = renderContext->args->getViewFrustum(); auto projMat = viewFrustum.getProjection(); auto theNear = viewFrustum.getNearClip(); - auto jit = jitterBuffer.get().offsets[current]; + auto jit = jitterBuffer.get().offsets[(current < 0 ? SampleSequence::SEQUENCE_LENGTH : current)]; auto width = (float) renderContext->args->_viewport.z; auto height = (float) renderContext->args->_viewport.w; - // auto jx = -4.0 * jit.x / width; -// auto jy = -4.0 * jit.y / height; auto jx = 2.0 * jit.x / width; auto jy = 2.0 * jit.y / height; diff --git a/libraries/render-utils/src/taa.slh b/libraries/render-utils/src/taa.slh index fd4bcde377..f8debce7d9 100644 --- a/libraries/render-utils/src/taa.slh +++ b/libraries/render-utils/src/taa.slh @@ -14,8 +14,9 @@ <$declareDeferredFrameTransform()$> const int SEQUENCE_LENGTH = 16; +const int INFO_INDEX = SEQUENCE_LENGTH / 2; struct JitterSequence { - vec4 offsets[(SEQUENCE_LENGTH / 2) + 1]; + vec4 offsets[INFO_INDEX + 1]; }; layout(std140) uniform taaJitterBuffer { JitterSequence sequence; @@ -26,11 +27,11 @@ vec2 taa_getJitterSample(int index) { } int taa_getJitterSequenceLength() { - return int(sequence.offsets[(SEQUENCE_LENGTH / 2)].z); + return floatBitsToInt(sequence.offsets[INFO_INDEX].z); } int taa_getCurrentJitterIndex() { - return int(sequence.offsets[(SEQUENCE_LENGTH / 2)].w); + return floatBitsToInt(sequence.offsets[INFO_INDEX].w); } vec2 taa_getCurrentJitterSample() { @@ -269,7 +270,7 @@ vec3 taa_temporalReprojection(vec3 sourceColor, vec3 historyColor, vec2 fragUV, float k_feedback = mix(_FeedbackMin, _FeedbackMax, unbiased_weight_sqr); // output - vec3 nextColor = mix(texel1, texel0, k_feedback).xyz; + vec3 nextColor = mix(texel0, texel1, k_feedback).xyz; return taa_resolveColor(nextColor); } diff --git a/libraries/render-utils/src/taa_blend.slf b/libraries/render-utils/src/taa_blend.slf index ac8e18036a..0ef3728cc3 100644 --- a/libraries/render-utils/src/taa_blend.slf +++ b/libraries/render-utils/src/taa_blend.slf @@ -154,7 +154,6 @@ void main(void) { } if (distToRegionFXAA > 0.0) { - outFragColor.rgb = taa_evalTXAA(); return; } diff --git a/libraries/render-utils/src/velocityBuffer_cameraMotion.slf b/libraries/render-utils/src/velocityBuffer_cameraMotion.slf index d44219d25f..50ab39191f 100644 --- a/libraries/render-utils/src/velocityBuffer_cameraMotion.slf +++ b/libraries/render-utils/src/velocityBuffer_cameraMotion.slf @@ -27,10 +27,10 @@ void main(void) { float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x; float Zeye = evalZeyeFromZdb(Zdb); - if (Zeye <= -getPosLinearDepthFar()) { +/* if (Zeye <= -getPosLinearDepthFar()) { outFragColor = vec4(0.5, 0.5, 0.0, 0.0); return; - } + }*/ // The position of the pixel fragment in Eye space then in world space vec3 eyePos = evalEyePositionFromZeye(stereoSide.x, Zeye, texcoordPos); diff --git a/scripts/developer/utilities/lib/styles-uit/HifiConstants.qmlc b/scripts/developer/utilities/lib/styles-uit/HifiConstants.qmlc index a11d8cf029dcb2a16ad80b66aa3ac76475f0233e..369d4444878f60a092189d56d24fd586c7a0c747 100644 GIT binary patch delta 106 zcmaDcf%(M*W}U(^ljM}dl0-oU1_nk>R)%vaax!s@3=B5a3=DU@Bo!xd$^}mDUF9x# zN&L=6ogbB&p$rTRX$+YRISi=`Rt)-Jm<(olFl2&df*4X63K;Sydsek?zEU;C7XT#3 B9RmOW delta 104 zcmaDcf%(M*W}U(^ljM}dl0-oU1_nk>R))Potmk4G85nG;85nAuW^T0qCvEb_ZFTsZ z_rd2k>inow4Q60qNMp!k$YDrjuwu{$!(=eaogtH