mirror of
https://github.com/overte-org/overte.git
synced 2025-08-14 16:29:40 +02:00
61 lines
1.3 KiB
Text
61 lines
1.3 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// taa_blend.frag
|
|
// fragment shader
|
|
//
|
|
// Created by Sam Gateau on 8/17/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 DeferredBufferWrite.slh@>
|
|
|
|
uniform sampler2D currentMap;
|
|
uniform sampler2D colorMap;
|
|
uniform sampler2D historyMap;
|
|
uniform sampler2D velocityMap;
|
|
|
|
in vec2 varTexCoord0;
|
|
layout(location = 0) out vec4 outFragColor;
|
|
|
|
struct TAAParams
|
|
{
|
|
float debugX;
|
|
float blend;
|
|
float motionScale;
|
|
float spareB;
|
|
};
|
|
|
|
layout(std140) uniform taaParamsBuffer {
|
|
TAAParams params;
|
|
};
|
|
|
|
void main(void) {
|
|
outFragColor = texture(currentMap, varTexCoord0);
|
|
|
|
if (varTexCoord0.x > params.debugX) {
|
|
return;
|
|
}
|
|
|
|
vec3 sourceColor = texture(colorMap, varTexCoord0).xyz;
|
|
|
|
vec2 velocity = texture(velocityMap, varTexCoord0).xy;
|
|
vec2 prevTexCoord = varTexCoord0 - params.motionScale * velocity;
|
|
|
|
outFragColor = vec4(sourceColor, 1.0);
|
|
|
|
if (abs(varTexCoord0.x - params.debugX) < (1.0 / 2048.0)) {
|
|
outFragColor.rgb = vec3(1.0, 1.0, 0.0);
|
|
return;
|
|
}
|
|
|
|
if (dot(velocity, velocity) > 0.0001) {
|
|
outFragColor = vec4(0.0, 1.0, 1.0, 1.0);
|
|
}
|
|
|
|
|
|
}
|