Differential D16243 Diff 58431 source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
| #pragma BLENDER_REQUIRE(common_utiltex_lib.glsl) | #pragma BLENDER_REQUIRE(common_utiltex_lib.glsl) | ||||
| /* | /* | ||||
| * Based on: | * Based on: | ||||
| * A Fast and Stable Feature-Aware Motion Blur Filter | * A Fast and Stable Feature-Aware Motion Blur Filter | ||||
| * by Jean-Philippe Guertin, Morgan McGuire, Derek Nowrouzezahrai | * by Jean-Philippe Guertin, Morgan McGuire, Derek Nowrouzezahrai | ||||
| * | * | ||||
| * With modification from the presentation: | * With modification from the presentation: | ||||
| * Next Generation Post Processing in Call of Duty Advanced Warfare | * Next Generation Post Processing in Call of Duty Advanced Warfare | ||||
| * by Jorge Jimenez | * by Jorge Jimenez | ||||
| */ | */ | ||||
| uniform sampler2D colorBuffer; | |||||
| uniform depth2D depthBuffer; | |||||
| uniform sampler2D velocityBuffer; | |||||
| uniform sampler2D tileMaxBuffer; | |||||
| #define KERNEL 8 | #define KERNEL 8 | ||||
| uniform float depthScale; | |||||
| uniform ivec2 tileBufferSize; | |||||
| uniform vec2 viewportSize; | |||||
| uniform vec2 viewportSizeInv; | |||||
| uniform bool isPerspective; | |||||
| uniform vec2 nearFar; /* Near & far view depths values */ | |||||
| #define linear_depth(z) \ | #define linear_depth(z) \ | ||||
| ((isPerspective) ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \ | ((isPerspective) ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \ | ||||
| z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */ | z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */ | ||||
| in vec4 uvcoordsvar; | |||||
| out vec4 fragColor; | |||||
| #define saturate(a) clamp(a, 0.0, 1.0) | #define saturate(a) clamp(a, 0.0, 1.0) | ||||
| vec2 spread_compare(float center_motion_length, float sample_motion_length, float offset_length) | vec2 spread_compare(float center_motion_length, float sample_motion_length, float offset_length) | ||||
| { | { | ||||
| return saturate(vec2(center_motion_length, sample_motion_length) - offset_length + 1.0); | return saturate(vec2(center_motion_length, sample_motion_length) - offset_length + 1.0); | ||||
| } | } | ||||
| vec2 depth_compare(float center_depth, float sample_depth) | vec2 depth_compare(float center_depth, float sample_depth) | ||||
| ▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines | |||||