Skip to content

Commit cd59ff5

Browse files
committed
Add more context for motion filtering
1 parent e318c86 commit cd59ff5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crates/bevy_core_pipeline/src/motion_blur/motion_blur.wgsl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ fn fragment(
7878

7979
// If depth is not considered during sampling, you can end up sampling objects in front of a
8080
// fast moving object, which will cause the (possibly stationary) objects in front of that
81-
// fast moving object to smear. To prevent this, we check the depth of the fragment we are
82-
// sampling. If it is closer to the camera than this fragment (plus the user-defined bias),
83-
// we discard it. If the bias is too small, fragments from the same object will be filtered
84-
// out.
81+
// fast moving object to smear. To prevent this, we check the depth and velocity of the
82+
// fragment we are sampling.
8583
#ifdef NO_DEPTH_TEXTURE_SUPPORT
8684
let sample_depth = 0.0;
8785
#else
@@ -100,7 +98,8 @@ fn fragment(
10098

10199
var weight = 1.0;
102100
// if the sampled frag is in front of this frag, we want to scale its weight by how parallel
103-
// their motion vectors are.
101+
// their motion vectors are. This is because that means the sampled fragment is more likely
102+
// to have occupied this fragment during the course of its motion.
104103
if sample_depth > this_depth || !depth_supported {
105104
let this_len = length(this_motion_vector);
106105
let sample_len = length(sample_motion_vector);

0 commit comments

Comments
 (0)