Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_motion_blur.c
| Show All 34 Lines | |||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_camera_types.h" | #include "DNA_camera_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "eevee_private.h" | #include "eevee_private.h" | ||||
| #include "GPU_texture.h" | #include "GPU_texture.h" | ||||
| static struct { | static struct { | ||||
| /* Motion Blur */ | /* Motion Blur */ | ||||
| struct GPUShader *motion_blur_sh; | struct GPUShader *motion_blur_sh; | ||||
| } e_data = {NULL}; /* Engine data */ | } e_data = {NULL}; /* Engine data */ | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, | ||||
| RE_engine_id_BLENDER_EEVEE); | RE_engine_id_BLENDER_EEVEE); | ||||
| if (BKE_collection_engine_property_value_get_bool(props, "motion_blur_enable")) { | if (BKE_collection_engine_property_value_get_bool(props, "motion_blur_enable")) { | ||||
| /* Update Motion Blur Matrices */ | /* Update Motion Blur Matrices */ | ||||
| if (rv3d->persp == RV3D_CAMOB && v3d->camera) { | if (rv3d->persp == RV3D_CAMOB && v3d->camera) { | ||||
| float persmat[4][4]; | float persmat[4][4]; | ||||
| float ctime = BKE_scene_frame_get(scene); | float ctime = BKE_scene_frame_get(scene); | ||||
| float delta = BKE_collection_engine_property_value_get_float(props, "motion_blur_shutter"); | float delta = BKE_collection_engine_property_value_get_float(props, "motion_blur_shutter"); | ||||
| Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); | |||||
| /* Current matrix */ | /* Current matrix */ | ||||
| eevee_motion_blur_camera_get_matrix_at_time(scene, | eevee_motion_blur_camera_get_matrix_at_time(scene, | ||||
| ar, rv3d, v3d, | ar, rv3d, v3d, | ||||
| v3d->camera, | camera_object, | ||||
| ctime, | ctime, | ||||
| effects->current_ndc_to_world); | effects->current_ndc_to_world); | ||||
| /* Viewport Matrix */ | /* Viewport Matrix */ | ||||
| DRW_viewport_matrix_get(persmat, DRW_MAT_PERS); | DRW_viewport_matrix_get(persmat, DRW_MAT_PERS); | ||||
| /* Only continue if camera is not being keyed */ | /* Only continue if camera is not being keyed */ | ||||
| if (DRW_state_is_image_render() || | if (DRW_state_is_image_render() || | ||||
| compare_m4m4(persmat, effects->current_ndc_to_world, 0.0001f)) | compare_m4m4(persmat, effects->current_ndc_to_world, 0.0001f)) | ||||
| { | { | ||||
| /* Past matrix */ | /* Past matrix */ | ||||
| eevee_motion_blur_camera_get_matrix_at_time(scene, | eevee_motion_blur_camera_get_matrix_at_time(scene, | ||||
| ar, rv3d, v3d, | ar, rv3d, v3d, | ||||
| v3d->camera, | camera_object, | ||||
| ctime - delta, | ctime - delta, | ||||
| effects->past_world_to_ndc); | effects->past_world_to_ndc); | ||||
| #if 0 /* for future high quality blur */ | #if 0 /* for future high quality blur */ | ||||
| /* Future matrix */ | /* Future matrix */ | ||||
| eevee_motion_blur_camera_get_matrix_at_time(scene, | eevee_motion_blur_camera_get_matrix_at_time(scene, | ||||
| ar, rv3d, v3d, | ar, rv3d, v3d, | ||||
| v3d->camera, | camera_object, | ||||
| ctime + delta, | ctime + delta, | ||||
| effects->future_world_to_ndc); | effects->future_world_to_ndc); | ||||
| #endif | #endif | ||||
| invert_m4(effects->current_ndc_to_world); | invert_m4(effects->current_ndc_to_world); | ||||
| effects->motion_blur_samples = BKE_collection_engine_property_value_get_int(props, | effects->motion_blur_samples = BKE_collection_engine_property_value_get_int(props, | ||||
| "motion_blur_samples"); | "motion_blur_samples"); | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||