[Bf-blender-cvs] [f06fa3797b7] temp-lineart-contained: LineArt: Shifting fix for different camera fitting

YimingWu noreply at git.blender.org
Mon Jun 7 15:04:14 CEST 2021


Commit: f06fa3797b7907ef825ce6b7cb59501e534c80fc
Author: YimingWu
Date:   Mon Jun 7 20:00:46 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBf06fa3797b7907ef825ce6b7cb59501e534c80fc

LineArt: Shifting fix for different camera fitting

===================================================================

M	release/datafiles/locale
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===================================================================

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 2cef4877edc..5ab29b1331d 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 2cef4877edc40875978c4e95322bb5193f5815bf
+Subproject commit 5ab29b1331d2103dae634b987f121c4599459d7f
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index e0005029fbc..08a28bf5dff 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2032,41 +2032,30 @@ static void lineart_main_load_geometries(
 
   Camera *cam = camera->data;
   float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
-  double fov = focallength_to_fov(cam->lens, sensor);
-
+  int fit = BKE_camera_sensor_fit(cam->sensor_fit, rb->w, rb->h);
   double asp = ((double)rb->w / (double)rb->h);
 
-  double t_start;
-
-  if (G.debug_value == 4000) {
-    t_start = PIL_check_seconds_timer();
-  }
-
   if (cam->type == CAM_PERSP) {
-    if (cam->sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
-      if (asp < 1) {
-        fov /= asp;
-      }
-      else {
-        fov *= asp;
-      }
+    if (fit == CAMERA_SENSOR_FIT_VERT && asp > 1) {
+      sensor *= asp;
     }
-    else if (cam->sensor_fit == CAMERA_SENSOR_FIT_HOR) {
-      if (asp < 1) {
-        fov /= asp;
-      }
-    }
-    else if (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) {
-      if (asp > 1) {
-        fov *= asp;
-      }
+    if (fit == CAMERA_SENSOR_FIT_HOR && asp < 1) {
+      sensor /= asp;
     }
+    double fov = focallength_to_fov(cam->lens, sensor);
     lineart_matrix_perspective_44d(proj, fov, asp, cam->clip_start, cam->clip_end);
   }
   else if (cam->type == CAM_ORTHO) {
     double w = cam->ortho_scale / 2;
     lineart_matrix_ortho_44d(proj, -w, w, -w / asp, w / asp, cam->clip_start, cam->clip_end);
   }
+
+  double t_start;
+
+  if (G.debug_value == 4000) {
+    t_start = PIL_check_seconds_timer();
+  }
+
   invert_m4_m4(inv, rb->cam_obmat);
   mul_m4db_m4db_m4fl_uniq(result, proj, inv);
   copy_m4_m4_db(proj, result);
@@ -3021,8 +3010,9 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene,
   }
 
   double asp = ((double)rb->w / (double)rb->h);
-  rb->shift_x = (asp >= 1) ? c->shiftx : c->shiftx * asp;
-  rb->shift_y = (asp <= 1) ? c->shifty : c->shifty * asp;
+  int fit = BKE_camera_sensor_fit(c->sensor_fit, rb->w, rb->h);
+  rb->shift_x = fit == CAMERA_SENSOR_FIT_HOR ? c->shiftx : c->shiftx / asp;
+  rb->shift_y = fit == CAMERA_SENSOR_FIT_VERT ? c->shifty : c->shifty * asp;
 
   rb->crease_threshold = cos(M_PI - lmd->crease_threshold);
   rb->chaining_image_threshold = lmd->chaining_image_threshold;



More information about the Bf-blender-cvs mailing list