Fix T101824: Line art flickers when light object has scaling.

Line art doesn't expect light or camera objects to have scaling.
This commit is contained in:
YimingWu 2023-01-12 13:36:05 +01:00 committed by Philipp Oeser
parent f32939af53
commit 9d3d9019ab
Notes: blender-bot 2023-02-14 00:44:02 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #101824, Line Art light/shadow glitch if the light object has non-uniform z axis scale
1 changed files with 8 additions and 0 deletions

View File

@ -3573,6 +3573,10 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
copy_v3db_v3fl(ld->conf.active_camera_pos, active_camera->obmat[3]);
}
copy_m4_m4(ld->conf.cam_obmat, camera->obmat);
/* Make sure none of the scaling factor makes in, line art expects no scaling on cameras and lights. */
normalize_v3(ld->conf.cam_obmat[0]);
normalize_v3(ld->conf.cam_obmat[1]);
normalize_v3(ld->conf.cam_obmat[2]);
ld->conf.cam_is_persp = (c->type == CAM_PERSP);
ld->conf.near_clip = c->clip_start + clipping_offset;
@ -3601,6 +3605,10 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
Object *light_obj = lmd->light_contour_object;
copy_v3db_v3fl(ld->conf.camera_pos_secondary, light_obj->obmat[3]);
copy_m4_m4(ld->conf.cam_obmat_secondary, light_obj->obmat);
/* Make sure none of the scaling factor makes in, line art expects no scaling on cameras and lights. */
normalize_v3(ld->conf.cam_obmat_secondary[0]);
normalize_v3(ld->conf.cam_obmat_secondary[1]);
normalize_v3(ld->conf.cam_obmat_secondary[2]);
ld->conf.light_reference_available = true;
if (light_obj->type == OB_LAMP) {
ld->conf.cam_is_persp_secondary = ((Light *)light_obj->data)->type != LA_SUN;