EEVEE: Motion Blur: Add shutter position option

This makes it easier to generate motion trail effect with EEVEE.

This just mimics the cycles option as described here:
https://docs.blender.org/manual/en/latest/render/cycles/render_settings/motion_blur.html

This fix T80070
This commit is contained in:
2020-10-13 16:55:19 +02:00
parent ed96c59c20
commit b7afcdff7b
4 changed files with 50 additions and 5 deletions

View File

@@ -460,13 +460,27 @@ static void eevee_render_to_image(void *vedata,
int initial_frame = CFRA;
float initial_subframe = SUBFRA;
int steps = max_ii(1, scene->eevee.motion_blur_steps);
int time_steps_tot = (do_motion_blur) ? steps : 1;
float shuttertime = (do_motion_blur) ? scene->eevee.motion_blur_shutter : 0.0f;
int time_steps_tot = (do_motion_blur) ? max_ii(1, scene->eevee.motion_blur_steps) : 1;
g_data->render_tot_samples = divide_ceil_u(scene->eevee.taa_render_samples, time_steps_tot);
/* Centered on frame for now. */
float time = initial_frame + initial_subframe - scene->eevee.motion_blur_shutter / 2.0f;
/* Compute start time. The motion blur will cover `[time ...time + shuttertime]`. */
float time = initial_frame + initial_subframe;
switch (scene->eevee.motion_blur_position) {
case SCE_EEVEE_MB_START:
/* No offset. */
break;
case SCE_EEVEE_MB_CENTER:
time -= shuttertime * 0.5f;
break;
case SCE_EEVEE_MB_END:
time -= shuttertime;
break;
default:
BLI_assert(!"Invalid motion blur position enum!");
break;
}
float time_step = scene->eevee.motion_blur_shutter / time_steps_tot;
float time_step = shuttertime / time_steps_tot;
for (int i = 0; i < time_steps_tot && !RE_engine_test_break(engine); i++) {
float time_prev = time;
float time_curr = time + time_step * 0.5f;