Documents motion_blur.h/.c. Almost exclusively used directly by FieldMotionBlur.
All of the currently undocumented functions inside motion_blur.c are documented by #219.
The MotionBlur system, is really just a wrapper around the DS's capture system, however it is exclusively used for blurring the screen.
You start the system using MotionBlur_New and stop it with MotionBlur_Delete. Once started, a "screenshot" will be made every frame and written to a buffer. This buffer can then be blended with data from another data.
As an example, FieldMotionBlur passes the following parameters to MotionBlur_New:
Because the captureMode is set to GX_CAPTURE_MODE_AB that means each capture of captureSourceA is blended together with captureSourceB and stored at captureDestination. The destination address is also the same as capture source B, which leads to every new frame being blended together with the previously blended frame, resulting in a motion blur.
The blend coefficients affect the output color, and how each capture source is mixed in. The formula for this is:
Documents motion_blur.h/.c. Almost exclusively used directly by
FieldMotionBlur
. All of the currently undocumented functions insidemotion_blur.c
are documented by #219.The
MotionBlur
system, is really just a wrapper around the DS's capture system, however it is exclusively used for blurring the screen.You start the system using
MotionBlur_New
and stop it withMotionBlur_Delete
. Once started, a "screenshot" will be made every frame and written to a buffer. This buffer can then be blended with data from another data.As an example,
FieldMotionBlur
passes the following parameters toMotionBlur_New
:Because the
captureMode
is set toGX_CAPTURE_MODE_AB
that means each capture ofcaptureSourceA
is blended together withcaptureSourceB
and stored atcaptureDestination
. The destination address is also the same as capture source B, which leads to every new frame being blended together with the previously blended frame, resulting in a motion blur.The blend coefficients affect the output color, and how each capture source is mixed in. The formula for this is:
$$ C_{OUT} = \cfrac{(C_A \times A_A \times EV_A)+(C_B \times A_B \times EV_B)}{16} $$
where
So if you want to maintain the screen brightness, make sure $EV_a + EV_b = 16$.
Using
FieldMotionBlur
with $EV_A = EV_B = 8$ results in the following:https://github.com/pret/pokeplatinum/assets/60443001/7e0bf256-d2ce-48f8-a0ae-9604d963a2d7