Fix T79637 Motion blur gives artifacts when changing the camera
DRW_render_set_time is calling RE_engine_frame_set will in turn calls BKE_scene_camera_switch_update. To workaround this, we get the original camera object at render init and get the evaluated version from it after each time change.
This commit is contained in:
parent
879ed5a165
commit
2218b61e8e
Notes:
blender-bot
2023-02-14 08:24:03 +01:00
Referenced by issue #79637, Motion blur gives artifacts when changing the camera
|
@ -920,6 +920,9 @@ typedef struct EEVEE_PrivateData {
|
|||
float camtexcofac[4];
|
||||
float size_orig[2];
|
||||
|
||||
/* Cached original camera when rendering for motion blur (see T79637). */
|
||||
struct Object *cam_original_ob;
|
||||
|
||||
/* Mist Settings */
|
||||
float mist_start, mist_inv_dist, mist_falloff;
|
||||
|
||||
|
|
|
@ -124,6 +124,9 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph *
|
|||
GPU_framebuffer_ensure_config(&fbl->main_color_fb,
|
||||
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)});
|
||||
|
||||
/* Camera could change because of Motion blur. */
|
||||
g_data->cam_original_ob = RE_GetCamera(engine->re);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -133,9 +136,10 @@ void EEVEE_render_modules_init(EEVEE_Data *vedata,
|
|||
{
|
||||
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
|
||||
EEVEE_StorageList *stl = vedata->stl;
|
||||
EEVEE_PrivateData *g_data = vedata->stl->g_data;
|
||||
EEVEE_FramebufferList *fbl = vedata->fbl;
|
||||
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
|
||||
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
|
||||
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob);
|
||||
EEVEE_render_view_sync(vedata, engine, depsgraph);
|
||||
|
||||
/* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`.
|
||||
|
@ -154,7 +158,7 @@ void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Dep
|
|||
/* Set the pers & view matrix. */
|
||||
float winmat[4][4], viewmat[4][4], viewinv[4][4];
|
||||
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
|
||||
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
|
||||
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob);
|
||||
|
||||
RE_GetCameraWindow(engine->re, ob_camera_eval, winmat);
|
||||
RE_GetCameraWindowWithOverscan(engine->re, g_data->overscan, winmat);
|
||||
|
|
Loading…
Reference in New Issue