adding disabling of jittering for comparison

This commit is contained in:
Sam Gateau 2017-08-31 23:42:43 -07:00
parent ddb598203e
commit a3f1c487f1
5 changed files with 14 additions and 11 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -154,7 +154,6 @@ void main(void) {
}
if (distToRegionFXAA > 0.0) {
outFragColor.rgb = taa_evalTXAA();
return;
}

View file

@ -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);