mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
51 lines
1.4 KiB
Text
51 lines
1.4 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// taa.frag
|
|
// fragment shader
|
|
//
|
|
// Created by Sam Gateau on 8/14/2017
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
|
|
<@include taa.slh@>
|
|
|
|
layout(location=0) in vec2 varTexCoord0;
|
|
layout(location=0) out vec4 outFragColor;
|
|
|
|
void main() {
|
|
vec2 fragUV = varTexCoord0;
|
|
|
|
// Debug region before debug or fxaa region X
|
|
float distToRegionFXAA = fragUV.x - taa_getRegionFXAA().x;
|
|
if (distToRegionFXAA > 0.0) {
|
|
outFragColor = vec4(taa_evalFXAA(fragUV), 1.0);
|
|
return;
|
|
}
|
|
|
|
vec2 fragVel = taa_fetchVelocityMapBest(fragUV).xy;
|
|
|
|
vec3 sourceColor;
|
|
vec3 historyColor;
|
|
vec2 prevFragUV = taa_fetchSourceAndHistory(fragUV, fragVel, sourceColor, historyColor);
|
|
|
|
vec3 nextColor = sourceColor;
|
|
|
|
if (taa_constrainColor()) {
|
|
// clamp history to neighbourhood of current sample
|
|
historyColor = taa_evalConstrainColor(sourceColor, fragUV, fragVel, historyColor);
|
|
}
|
|
|
|
if (taa_feedbackColor()) {
|
|
nextColor = taa_evalFeedbackColor(sourceColor, historyColor, params.blend);
|
|
} else {
|
|
nextColor = mix(historyColor, sourceColor, params.blend);
|
|
}
|
|
|
|
outFragColor = vec4(taa_resolveColor(nextColor), 1.0);
|
|
}
|