mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 23:10:37 +02:00
37 lines
1,014 B
Text
37 lines
1,014 B
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@>
|
|
|
|
in vec2 varTexCoord0;
|
|
layout(location = 0) out vec4 outFragColor;
|
|
|
|
void main() {
|
|
vec3 currentColor = texture(colorMap, varTexCoord0).xyz;
|
|
|
|
vec2 pixVelocity = texture(velocityMap, varTexCoord0).xy;
|
|
vec2 velocity = params.motionScale * pixVelocity;// *getInvWidthHeight();
|
|
vec2 prevTexCoord = varTexCoord0 - velocity;
|
|
|
|
vec3 prevColor = currentColor;
|
|
|
|
if (!(any(lessThan(prevTexCoord, vec2(0.0))) || any(greaterThan(prevTexCoord, vec2(1.0))))) {
|
|
prevColor = texture(historyMap, prevTexCoord).xyz;
|
|
}
|
|
|
|
vec3 newColor = mix(prevColor, currentColor, params.blend);
|
|
|
|
outFragColor = vec4(newColor, 1.0);
|
|
}
|