diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-10-31 20:31:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-31 20:32:54 +0300 |
commit | cde64619cab3674dd4aa2d064406a71efbe2c4d7 (patch) | |
tree | 3b9c5df8cf4f2471aa1da33d2428665288d55c47 /source/blender/render/intern | |
parent | c6466ed0d2fc86d3a0c92acd07a154249921eaa6 (diff) |
Eevee: Implement Overscan option
This option make the internal render size larger than the output size in
order to minimize screenspace effects disapearing at the render edges.
The overscan size added around the render is the maximum dimension
multiplied by the overscan percentage.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/source/initrender.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 828d626f9a7..1420b8feef7 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -195,6 +195,25 @@ void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, flo copy_m4_m4(mat, re->winmat); } +/* Must be called after RE_GetCameraWindow(), does not change re->winmat. */ +void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float overscan) +{ + CameraParams params; + params.is_ortho = re->winmat[3][3] != 0.0f; + params.clipsta = re->clipsta; + params.clipend = re->clipend; + params.viewplane = re->viewplane; + + overscan *= max_ff(BLI_rctf_size_x(¶ms.viewplane), BLI_rctf_size_y(¶ms.viewplane)); + + params.viewplane.xmin -= overscan; + params.viewplane.xmax += overscan; + params.viewplane.ymin -= overscan; + params.viewplane.ymax += overscan; + BKE_camera_params_compute_matrix(¶ms); + copy_m4_m4(mat, params.winmat); +} + void RE_GetCameraModelMatrix(Render *re, struct Object *camera, float r_mat[4][4]) { BKE_camera_multiview_model_matrix(&re->r, camera, re->viewname, r_mat); |