Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl
| #pragma BLENDER_REQUIRE(common_math_lib.glsl) | #pragma BLENDER_REQUIRE(common_math_lib.glsl) | ||||
| #pragma BLENDER_REQUIRE(common_view_lib.glsl) | #pragma BLENDER_REQUIRE(common_view_lib.glsl) | ||||
| uniform sampler2D colorBuffer; | /*uniform sampler2D colorBuffer; | ||||
| uniform depth2D depthBuffer; | uniform depth2D depthBuffer; | ||||
| uniform sampler2D colorHistoryBuffer; | uniform sampler2D colorHistoryBuffer; | ||||
| uniform mat4 prevViewProjectionMatrix; | uniform mat4 prevViewProjectionMatrix; | ||||
| out vec4 FragColor; | out vec4 FragColor;*/ | ||||
| #ifdef USE_REPROJECTION | #ifdef USE_REPROJECTION | ||||
| /** | /** | ||||
| * Adapted from https://casual-effects.com/g3d/G3D10/data-files/shader/Film/Film_temporalAA.pix | * Adapted from https://casual-effects.com/g3d/G3D10/data-files/shader/Film/Film_temporalAA.pix | ||||
| * which is adapted from | * which is adapted from | ||||
| * https://github.com/gokselgoktas/temporal-anti-aliasing/blob/master/Assets/Resources/Shaders/TemporalAntiAliasing.cginc | * https://github.com/gokselgoktas/temporal-anti-aliasing/blob/master/Assets/Resources/Shaders/TemporalAntiAliasing.cginc | ||||
| * which is adapted from https://github.com/playdeadgames/temporal | * which is adapted from https://github.com/playdeadgames/temporal | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | void main() | ||||
| FragColor = safe_color(color_history); | FragColor = safe_color(color_history); | ||||
| /* There is some ghost issue if we use the alpha | /* There is some ghost issue if we use the alpha | ||||
| * in the viewport. Overwriting alpha fixes it. */ | * in the viewport. Overwriting alpha fixes it. */ | ||||
| FragColor.a = color.a; | FragColor.a = color.a; | ||||
| } | } | ||||
| #else | #else | ||||
| uniform float alpha; | |||||
| void main() | void main() | ||||
| { | { | ||||
| ivec2 texel = ivec2(gl_FragCoord.xy); | ivec2 texel = ivec2(gl_FragCoord.xy); | ||||
| vec4 color = texelFetch(colorBuffer, texel, 0); | vec4 color = texelFetch(colorBuffer, texel, 0); | ||||
| vec4 color_history = texelFetch(colorHistoryBuffer, texel, 0); | vec4 color_history = texelFetch(colorHistoryBuffer, texel, 0); | ||||
| FragColor = safe_color(mix(color_history, color, alpha)); | FragColor = safe_color(mix(color_history, color, alpha)); | ||||
| } | } | ||||
| #endif | #endif | ||||