mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:19:24 +02:00
A bit of cleanup in TAA shaders
This commit is contained in:
parent
dca7b7aaba
commit
aa46d16699
2 changed files with 14 additions and 4 deletions
|
@ -38,6 +38,10 @@ layout(std140) uniform taaParamsBuffer {
|
||||||
|
|
||||||
#define GET_BIT(bitfield, bitIndex) bool((bitfield) & (1 << (bitIndex)))
|
#define GET_BIT(bitfield, bitIndex) bool((bitfield) & (1 << (bitIndex)))
|
||||||
|
|
||||||
|
bool taa_isDebugEnabled() {
|
||||||
|
return GET_BIT(params.flags.x, 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool taa_showDebugCursor() {
|
bool taa_showDebugCursor() {
|
||||||
return GET_BIT(params.flags.x, 1);
|
return GET_BIT(params.flags.x, 1);
|
||||||
}
|
}
|
||||||
|
@ -247,14 +251,19 @@ vec2 taa_fromEyeUVToFragUV(vec2 eyeUV, int stereoSide) {
|
||||||
return fragUV;
|
return fragUV;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 taa_fetchSourceAndHistory(vec2 fragUV, vec2 fragVelocity, out vec3 sourceColor, out vec3 historyColor) {
|
vec2 taa_computePrevFragAndEyeUV(vec2 fragUV, vec2 fragVelocity, out vec2 prevEyeUV) {
|
||||||
sourceColor = taa_fetchSourceMap(fragUV).xyz;
|
|
||||||
int stereoSide = 0;
|
int stereoSide = 0;
|
||||||
vec2 eyeUV = taa_fromFragUVToEyeUVAndSide(fragUV, stereoSide);
|
vec2 eyeUV = taa_fromFragUVToEyeUVAndSide(fragUV, stereoSide);
|
||||||
vec2 prevEyeUV = eyeUV - fragVelocity;
|
prevEyeUV = eyeUV - fragVelocity;
|
||||||
|
return taa_fromEyeUVToFragUV(prevEyeUV, stereoSide);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 taa_fetchSourceAndHistory(vec2 fragUV, vec2 fragVelocity, out vec3 sourceColor, out vec3 historyColor) {
|
||||||
|
vec2 prevEyeUV;
|
||||||
|
vec2 prevFragUV = taa_computePrevFragAndEyeUV(fragUV, fragVelocity, prevEyeUV);
|
||||||
|
sourceColor = taa_fetchSourceMap(fragUV).xyz;
|
||||||
|
|
||||||
historyColor = sourceColor;
|
historyColor = sourceColor;
|
||||||
vec2 prevFragUV = taa_fromEyeUVToFragUV(prevEyeUV, stereoSide);
|
|
||||||
if (!(any(lessThan(prevEyeUV, vec2(0.0))) || any(greaterThan(prevEyeUV, vec2(1.0))))) {
|
if (!(any(lessThan(prevEyeUV, vec2(0.0))) || any(greaterThan(prevEyeUV, vec2(1.0))))) {
|
||||||
historyColor = taa_fetchHistoryMap(prevFragUV).xyz;
|
historyColor = taa_fetchHistoryMap(prevFragUV).xyz;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,7 @@ void main(void) {
|
||||||
if (!(any(lessThan(prevTexCoord, vec2(0.0))) || any(greaterThan(prevTexCoord, vec2(1.0))))) {
|
if (!(any(lessThan(prevTexCoord, vec2(0.0))) || any(greaterThan(prevTexCoord, vec2(1.0))))) {
|
||||||
prevColor = texture(historyMap, prevTexCoord).xyz;
|
prevColor = texture(historyMap, prevTexCoord).xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
outFragColor.xyz = mix(prevColor, vec3(1,0,1), clamp(distance(prevColor, nextColor) - 0.01, 0, 1));
|
outFragColor.xyz = mix(prevColor, vec3(1,0,1), clamp(distance(prevColor, nextColor) - 0.01, 0, 1));
|
||||||
|
|
||||||
if (pixVelocityLength > params.debugShowVelocityThreshold) {
|
if (pixVelocityLength > params.debugShowVelocityThreshold) {
|
||||||
|
|
Loading…
Reference in a new issue