experimental TAA setting (reduce clamping radius during motion)

This commit is contained in:
Xonk
2026-01-04 00:58:44 -05:00
parent 4e2b9ec934
commit bccc0ddcd7
4 changed files with 25 additions and 12 deletions
+17 -10
View File
@@ -339,7 +339,14 @@ vec4 computeTAA(vec2 texcoord, bool hand){
vec2 velocity = previousPosition.xy - closestToCamera.xy;
previousPosition.xy = texcoord + (hand ? vec2(0.0) : velocity);
// adjust clamping radius when motion is detected to reduce ghosting further without needing to change blend factor
#if NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT > 99
float clampRadius = mix(1.0, float(NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT)/100.0f, clamp(length(velocity/texelSize),0.0,1.0) );
#else
float clampRadius = 1.0;
#endif
// sample current frame, and make sure it is de-jittered
#if TAA_MODE == 3
vec3 currentFrame = smoothfilter(colortex3, adjTC_noJitter).rgb;
@@ -357,14 +364,14 @@ vec4 computeTAA(vec2 texcoord, bool hand){
#else
//Assuming the history color is a blend of the 3x3 neighborhood, we clamp the history to the min and max of each channel in the 3x3 neighborhood
vec3 col0 = currentFrame; // can use this because its the center sample.
vec3 col1 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, texelSize.y)).rgb;
vec3 col2 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)).rgb;
vec3 col3 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)).rgb;
vec3 col4 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)).rgb;
vec3 col5 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)).rgb;
vec3 col6 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)).rgb;
vec3 col7 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)).rgb;
vec3 col8 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)).rgb;
vec3 col1 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, texelSize.y)*clampRadius).rgb;
vec3 col2 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)*clampRadius).rgb;
vec3 col3 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)*clampRadius).rgb;
vec3 col4 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)*clampRadius).rgb;
vec3 col5 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)*clampRadius).rgb;
vec3 col6 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)*clampRadius).rgb;
vec3 col7 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)*clampRadius).rgb;
vec3 col8 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)*clampRadius).rgb;
vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8))))))));
vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8))))))));
@@ -386,7 +393,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){
// reduce history usage if the camera moves to reduce artifacts in motion.
float cameraMovement = length(velocity/texelSize);
blendingFactor = clamp(cameraMovement, blendingFactor, BLEND_FACTOR_DURING_MOVEMENT);
if(hand) blendingFactor = clamp(cameraMovement, blendingFactor, 1.0);
// if(hand) blendingFactor = clamp(cameraMovement, blendingFactor, 1.0);
////// Increases blending factor when far from AABB, reduces ghosting
blendingFactor = clamp(blendingFactor + luma(abs(clampedframeHistory - frameHistory)/clampedframeHistory),0.0,1.0);
+5
View File
@@ -549,6 +549,11 @@ screen.Post_Processing = Post Processing
value.TAA_MODE.3 = Temporal Upscaling
option.BLEND_FACTOR = Blend Factor
option.BLEND_FACTOR_DURING_MOVEMENT = Blend Factor During Camera Movment
option.NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT = Clamping Radius During Camera Movment
value.NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT.100 = OFF
suffix.NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT =%
option.NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT.comment = lower means less ghosting in motion, but more flickering and noise... this is an alternative to adjusting blending factor
option.SCALE_FACTOR = Scale Factor §a(set TAA mode to "Temporal Upscaling")
prefix.SCALE_FACTOR = §fUpscale from
suffix.SCALE_FACTOR = x §fof the window resolution
+1
View File
@@ -173,6 +173,7 @@
// #define SCREENSHOT_MODE
#define BLEND_FACTOR 0.125 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.125 0.14 0.16 0.18 0.20 0.25 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00]
#define BLEND_FACTOR_DURING_MOVEMENT 0.125 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.125 0.14 0.16 0.18 0.20 0.25 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00]
#define NEIGHBORHOOD_CLAMP_RADIUS_MULT_DURING_MOVEMENT 50 // [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100]
#endif
#if defined POST_PROCESSING_RELATED_SETTINGS
File diff suppressed because one or more lines are too long