@@ -130,6 +130,7 @@ OutputSolver FragSolver(VaryingsSolver input)
130130#if TAA_DILATE_MOTION_VECTOR_SAMPLE
131131 float2 motion = tex2D (_CameraMotionVectorsTexture, GetClosestFragment (input.uv.zw)).xy;
132132#else
133+ // Don't dilate in ortho !
133134 float2 motion = tex2D (_CameraMotionVectorsTexture, input.uv.zw).xy;
134135#endif
135136
@@ -149,9 +150,11 @@ OutputSolver FragSolver(VaryingsSolver input)
149150
150151 float4 corners = 4.0 * (topLeft + bottomRight) - 2.0 * color;
151152
153+ // Sharpen output
152154 color += (color - (corners * 0.166667 )) * 2.718282 * _SharpenParameters.x;
153155 color = max (0.0 , color);
154156
157+ // Tonemap color and history samples
155158 float4 average = FastToneMap ((corners + color) * 0.142857 );
156159
157160 topLeft = FastToneMap (topLeft);
@@ -161,6 +164,7 @@ OutputSolver FragSolver(VaryingsSolver input)
161164
162165 float4 history = tex2D (_HistoryTex, input.uv.zw - motion);
163166
167+ // Only use this variant for arch viz or scenes that don't have any animated objects (camera animation is fine)
164168#if TAA_USE_STABLE_BUT_GHOSTY_VARIANT
165169 float4 luma = float4 (Luminance (topLeft.rgb), Luminance (bottomRight.rgb), Luminance (average.rgb), Luminance (color.rgb));
166170 float nudge = lerp (6.28318530718 , 0.5 , saturate (2.0 * history.a)) * max (abs (luma.z - luma.w), abs (luma.x - luma.y));
@@ -176,10 +180,14 @@ OutputSolver FragSolver(VaryingsSolver input)
176180#endif
177181
178182 history = FastToneMap (history);
183+
184+ // Clip history samples
179185 history = ClipToAABB (history, history.a, minimum.xyz, maximum.xyz);
180186
187+ // Store fragment motion history
181188 color.a = saturate (smoothstep (0.002 * _MainTex_TexelSize.z, 0.0035 * _MainTex_TexelSize.z, length (motion)));
182189
190+ // Blend method
183191 float weight = clamp (lerp (TAA_FINAL_BLEND_STATIC_FACTOR, TAA_FINAL_BLEND_DYNAMIC_FACTOR,
184192 length (motion) * TAA_MOTION_AMPLIFICATION), TAA_FINAL_BLEND_DYNAMIC_FACTOR, TAA_FINAL_BLEND_STATIC_FACTOR);
185193
0 commit comments