2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/camera.h"
|
2022-10-03 19:26:02 +02:00
|
|
|
#include "scene/bake.h"
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/scene.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "blender/sync.h"
|
|
|
|
|
#include "blender/util.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/log.h"
|
2014-12-18 14:40:14 +05:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
/* Blender Camera Intermediate: we first convert both the offline and 3d view
|
|
|
|
|
* render camera to this, and from there convert to our native camera format. */
|
|
|
|
|
|
|
|
|
|
struct BlenderCamera {
|
|
|
|
|
float nearclip;
|
|
|
|
|
float farclip;
|
|
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
CameraType type;
|
2011-04-27 11:58:34 +00:00
|
|
|
float ortho_scale;
|
|
|
|
|
|
|
|
|
|
float lens;
|
2012-04-30 12:49:26 +00:00
|
|
|
float shuttertime;
|
2022-04-19 16:28:14 +02:00
|
|
|
MotionPosition motion_position;
|
2016-05-08 00:28:21 +02:00
|
|
|
array<float> shutter_curve;
|
2011-09-16 13:14:02 +00:00
|
|
|
|
2015-11-20 14:42:34 +05:00
|
|
|
Camera::RollingShutterType rolling_shutter_type;
|
|
|
|
|
float rolling_shutter_duration;
|
|
|
|
|
|
2011-09-16 13:14:02 +00:00
|
|
|
float aperturesize;
|
|
|
|
|
uint apertureblades;
|
|
|
|
|
float aperturerotation;
|
2011-04-27 11:58:34 +00:00
|
|
|
float focaldistance;
|
|
|
|
|
|
|
|
|
|
float2 shift;
|
|
|
|
|
float2 offset;
|
|
|
|
|
float zoom;
|
|
|
|
|
|
|
|
|
|
float2 pixelaspect;
|
|
|
|
|
|
2014-08-27 10:51:50 +02:00
|
|
|
float aperture_ratio;
|
|
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
PanoramaType panorama_type;
|
|
|
|
|
float fisheye_fov;
|
|
|
|
|
float fisheye_lens;
|
2015-01-14 23:14:45 +05:00
|
|
|
float latitude_min;
|
|
|
|
|
float latitude_max;
|
|
|
|
|
float longitude_min;
|
|
|
|
|
float longitude_max;
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
bool use_spherical_stereo;
|
|
|
|
|
float interocular_distance;
|
|
|
|
|
float convergence_distance;
|
2016-05-17 14:12:29 +02:00
|
|
|
bool use_pole_merge;
|
|
|
|
|
float pole_merge_angle_from;
|
|
|
|
|
float pole_merge_angle_to;
|
2012-05-04 16:20:51 +00:00
|
|
|
|
2021-12-07 18:54:36 +01:00
|
|
|
float fisheye_polynomial_k0;
|
|
|
|
|
float fisheye_polynomial_k1;
|
|
|
|
|
float fisheye_polynomial_k2;
|
|
|
|
|
float fisheye_polynomial_k3;
|
|
|
|
|
float fisheye_polynomial_k4;
|
|
|
|
|
|
2011-11-05 11:11:06 +00:00
|
|
|
enum { AUTO, HORIZONTAL, VERTICAL } sensor_fit;
|
|
|
|
|
float sensor_width;
|
|
|
|
|
float sensor_height;
|
|
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
int full_width;
|
|
|
|
|
int full_height;
|
|
|
|
|
|
2020-07-28 13:35:19 +02:00
|
|
|
int render_width;
|
|
|
|
|
int render_height;
|
|
|
|
|
|
2012-11-10 22:31:29 +00:00
|
|
|
BoundBox2D border;
|
2015-01-27 21:36:14 +05:00
|
|
|
BoundBox2D viewport_camera_border;
|
2021-10-11 20:05:25 +02:00
|
|
|
BoundBox2D pano_viewplane;
|
|
|
|
|
float pano_aspectratio;
|
2012-06-06 23:27:43 +00:00
|
|
|
|
2021-05-31 16:21:24 +02:00
|
|
|
float passepartout_alpha;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Transform matrix;
|
2018-01-12 00:50:34 +01:00
|
|
|
|
|
|
|
|
float offscreen_dicing_scale;
|
2018-03-10 01:36:09 +01:00
|
|
|
|
|
|
|
|
int motion_steps;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_init(BlenderCamera *bcam, BL::RenderSettings &b_render)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2018-06-11 12:54:17 +02:00
|
|
|
memset((void *)bcam, 0, sizeof(BlenderCamera));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-21 16:24:56 +02:00
|
|
|
bcam->nearclip = 1e-5f;
|
|
|
|
|
bcam->farclip = 1e5f;
|
|
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
bcam->type = CAMERA_PERSPECTIVE;
|
2019-06-21 16:24:56 +02:00
|
|
|
bcam->ortho_scale = 1.0f;
|
|
|
|
|
|
|
|
|
|
bcam->lens = 50.0f;
|
|
|
|
|
bcam->shuttertime = 1.0f;
|
|
|
|
|
|
|
|
|
|
bcam->rolling_shutter_type = Camera::ROLLING_SHUTTER_NONE;
|
|
|
|
|
bcam->rolling_shutter_duration = 0.1f;
|
|
|
|
|
|
|
|
|
|
bcam->aperturesize = 0.0f;
|
|
|
|
|
bcam->apertureblades = 0;
|
|
|
|
|
bcam->aperturerotation = 0.0f;
|
|
|
|
|
bcam->focaldistance = 10.0f;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bcam->zoom = 1.0f;
|
2021-02-17 01:47:18 +01:00
|
|
|
bcam->pixelaspect = one_float2();
|
2019-06-21 16:24:56 +02:00
|
|
|
bcam->aperture_ratio = 1.0f;
|
|
|
|
|
|
2018-05-15 17:32:16 +02:00
|
|
|
bcam->sensor_width = 36.0f;
|
|
|
|
|
bcam->sensor_height = 24.0f;
|
2011-11-05 11:11:06 +00:00
|
|
|
bcam->sensor_fit = BlenderCamera::AUTO;
|
2022-04-19 16:28:14 +02:00
|
|
|
bcam->motion_position = MOTION_POSITION_CENTER;
|
2012-11-10 22:31:29 +00:00
|
|
|
bcam->border.right = 1.0f;
|
|
|
|
|
bcam->border.top = 1.0f;
|
2015-01-27 21:36:14 +05:00
|
|
|
bcam->viewport_camera_border.right = 1.0f;
|
|
|
|
|
bcam->viewport_camera_border.top = 1.0f;
|
2021-10-11 20:05:25 +02:00
|
|
|
bcam->pano_viewplane.right = 1.0f;
|
|
|
|
|
bcam->pano_viewplane.top = 1.0f;
|
|
|
|
|
bcam->pano_aspectratio = 0.0f;
|
2021-05-31 16:21:24 +02:00
|
|
|
bcam->passepartout_alpha = 0.5f;
|
2018-01-12 00:50:34 +01:00
|
|
|
bcam->offscreen_dicing_scale = 1.0f;
|
2019-06-21 16:24:56 +02:00
|
|
|
bcam->matrix = transform_identity();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
/* render resolution */
|
2020-07-28 13:35:19 +02:00
|
|
|
bcam->render_width = render_resolution_x(b_render);
|
|
|
|
|
bcam->render_height = render_resolution_y(b_render);
|
|
|
|
|
bcam->full_width = bcam->render_width;
|
|
|
|
|
bcam->full_height = bcam->render_height;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static float blender_camera_focal_distance(BL::RenderEngine &b_engine,
|
|
|
|
|
BL::Object &b_ob,
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
BL::Camera &b_camera,
|
|
|
|
|
BlenderCamera *bcam)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2019-05-17 16:57:31 +02:00
|
|
|
BL::Object b_dof_object = b_camera.dof().focus_object();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (!b_dof_object) {
|
2019-05-17 16:57:31 +02:00
|
|
|
return b_camera.dof().focus_distance();
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-07-15 13:30:57 +02:00
|
|
|
Transform dofmat = get_transform(b_dof_object.matrix_world());
|
|
|
|
|
|
|
|
|
|
string focus_subtarget = b_camera.dof().focus_subtarget();
|
|
|
|
|
if (b_dof_object.pose() && !focus_subtarget.empty()) {
|
|
|
|
|
BL::PoseBone b_bone = b_dof_object.pose().bones[focus_subtarget];
|
|
|
|
|
if (b_bone) {
|
|
|
|
|
dofmat = dofmat * get_transform(b_bone.matrix());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-29 23:34:25 +00:00
|
|
|
/* for dof object, return distance along camera Z direction */
|
2015-04-06 10:40:12 -03:00
|
|
|
BL::Array<float, 16> b_ob_matrix;
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
b_engine.camera_model_matrix(b_ob, bcam->use_spherical_stereo, b_ob_matrix);
|
|
|
|
|
Transform obmat = transform_clear_scale(get_transform(b_ob_matrix));
|
2015-09-07 13:29:52 +10:00
|
|
|
float3 view_dir = normalize(transform_get_column(&obmat, 2));
|
|
|
|
|
float3 dof_dir = transform_get_column(&obmat, 3) - transform_get_column(&dofmat, 3);
|
|
|
|
|
return fabsf(dot(view_dir, dof_dir));
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2023-08-22 15:49:34 +02:00
|
|
|
static PanoramaType blender_panorama_type_to_cycles(const BL::Camera::panorama_type_enum type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case BL::Camera::panorama_type_EQUIRECTANGULAR:
|
|
|
|
|
return PANORAMA_EQUIRECTANGULAR;
|
|
|
|
|
case BL::Camera::panorama_type_EQUIANGULAR_CUBEMAP_FACE:
|
|
|
|
|
return PANORAMA_EQUIANGULAR_CUBEMAP_FACE;
|
|
|
|
|
case BL::Camera::panorama_type_MIRRORBALL:
|
|
|
|
|
return PANORAMA_MIRRORBALL;
|
|
|
|
|
case BL::Camera::panorama_type_FISHEYE_EQUIDISTANT:
|
|
|
|
|
return PANORAMA_FISHEYE_EQUIDISTANT;
|
|
|
|
|
case BL::Camera::panorama_type_FISHEYE_EQUISOLID:
|
|
|
|
|
return PANORAMA_FISHEYE_EQUISOLID;
|
|
|
|
|
case BL::Camera::panorama_type_FISHEYE_LENS_POLYNOMIAL:
|
|
|
|
|
return PANORAMA_FISHEYE_LENS_POLYNOMIAL;
|
|
|
|
|
}
|
|
|
|
|
/* Could happen if loading a newer file that has an unsupported type. */
|
|
|
|
|
return PANORAMA_FISHEYE_EQUISOLID;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_from_object(BlenderCamera *bcam,
|
|
|
|
|
BL::RenderEngine &b_engine,
|
|
|
|
|
BL::Object &b_ob,
|
|
|
|
|
bool skip_panorama = false)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
BL::ID b_ob_data = b_ob.data();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (b_ob_data.is_a(&RNA_Camera)) {
|
|
|
|
|
BL::Camera b_camera(b_ob_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bcam->nearclip = b_camera.clip_start();
|
|
|
|
|
bcam->farclip = b_camera.clip_end();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
switch (b_camera.type()) {
|
|
|
|
|
case BL::Camera::type_ORTHO:
|
|
|
|
|
bcam->type = CAMERA_ORTHOGRAPHIC;
|
|
|
|
|
break;
|
|
|
|
|
case BL::Camera::type_PANO:
|
2023-09-17 09:01:48 +10:00
|
|
|
if (!skip_panorama) {
|
2012-10-01 17:09:12 +00:00
|
|
|
bcam->type = CAMERA_PANORAMA;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-01 17:09:12 +00:00
|
|
|
bcam->type = CAMERA_PERSPECTIVE;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2012-05-04 16:20:51 +00:00
|
|
|
break;
|
|
|
|
|
case BL::Camera::type_PERSP:
|
|
|
|
|
default:
|
|
|
|
|
bcam->type = CAMERA_PERSPECTIVE;
|
|
|
|
|
break;
|
2016-02-10 03:25:53 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-22 15:49:34 +02:00
|
|
|
bcam->panorama_type = blender_panorama_type_to_cycles(b_camera.panorama_type());
|
|
|
|
|
bcam->fisheye_fov = b_camera.fisheye_fov();
|
|
|
|
|
bcam->fisheye_lens = b_camera.fisheye_lens();
|
|
|
|
|
bcam->latitude_min = b_camera.latitude_min();
|
|
|
|
|
bcam->latitude_max = b_camera.latitude_max();
|
|
|
|
|
bcam->longitude_min = b_camera.longitude_min();
|
|
|
|
|
bcam->longitude_max = b_camera.longitude_max();
|
|
|
|
|
|
|
|
|
|
bcam->fisheye_polynomial_k0 = b_camera.fisheye_polynomial_k0();
|
|
|
|
|
bcam->fisheye_polynomial_k1 = b_camera.fisheye_polynomial_k1();
|
|
|
|
|
bcam->fisheye_polynomial_k2 = b_camera.fisheye_polynomial_k2();
|
|
|
|
|
bcam->fisheye_polynomial_k3 = b_camera.fisheye_polynomial_k3();
|
|
|
|
|
bcam->fisheye_polynomial_k4 = b_camera.fisheye_polynomial_k4();
|
2021-12-07 18:54:36 +01:00
|
|
|
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
bcam->interocular_distance = b_camera.stereo().interocular_distance();
|
2016-03-11 21:58:47 +05:00
|
|
|
if (b_camera.stereo().convergence_mode() == BL::CameraStereoData::convergence_mode_PARALLEL) {
|
|
|
|
|
bcam->convergence_distance = FLT_MAX;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bcam->convergence_distance = b_camera.stereo().convergence_distance();
|
|
|
|
|
}
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
bcam->use_spherical_stereo = b_engine.use_spherical_stereo(b_ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-17 14:12:29 +02:00
|
|
|
bcam->use_pole_merge = b_camera.stereo().use_pole_merge();
|
|
|
|
|
bcam->pole_merge_angle_from = b_camera.stereo().pole_merge_angle_from();
|
|
|
|
|
bcam->pole_merge_angle_to = b_camera.stereo().pole_merge_angle_to();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bcam->ortho_scale = b_camera.ortho_scale();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bcam->lens = b_camera.lens();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-05-31 16:21:24 +02:00
|
|
|
bcam->passepartout_alpha = b_camera.show_passepartout() ? b_camera.passepartout_alpha() : 0.0f;
|
|
|
|
|
|
2019-05-17 16:57:31 +02:00
|
|
|
if (b_camera.dof().use_dof()) {
|
|
|
|
|
/* allow f/stop number to change aperture_size but still
|
|
|
|
|
* give manual control over aperture radius */
|
|
|
|
|
float fstop = b_camera.dof().aperture_fstop();
|
2013-03-21 02:38:11 +00:00
|
|
|
fstop = max(fstop, 1e-5f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (bcam->type == CAMERA_ORTHOGRAPHIC) {
|
2013-03-21 02:38:11 +00:00
|
|
|
bcam->aperturesize = 1.0f / (2.0f * fstop);
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-21 02:38:11 +00:00
|
|
|
bcam->aperturesize = (bcam->lens * 1e-3f) / (2.0f * fstop);
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-17 16:57:31 +02:00
|
|
|
bcam->apertureblades = b_camera.dof().aperture_blades();
|
|
|
|
|
bcam->aperturerotation = b_camera.dof().aperture_rotation();
|
|
|
|
|
bcam->focaldistance = blender_camera_focal_distance(b_engine, b_ob, b_camera, bcam);
|
|
|
|
|
bcam->aperture_ratio = b_camera.dof().aperture_ratio();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* DOF is turned of for the camera. */
|
|
|
|
|
bcam->aperturesize = 0.0f;
|
|
|
|
|
bcam->apertureblades = 0;
|
|
|
|
|
bcam->aperturerotation = 0.0f;
|
|
|
|
|
bcam->focaldistance = 0.0f;
|
|
|
|
|
bcam->aperture_ratio = 1.0f;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
bcam->shift.x = b_engine.camera_shift_x(b_ob, bcam->use_spherical_stereo);
|
2011-04-27 11:58:34 +00:00
|
|
|
bcam->shift.y = b_camera.shift_y();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-05 11:11:06 +00:00
|
|
|
bcam->sensor_width = b_camera.sensor_width();
|
|
|
|
|
bcam->sensor_height = b_camera.sensor_height();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (b_camera.sensor_fit() == BL::Camera::sensor_fit_AUTO) {
|
2011-11-05 11:11:06 +00:00
|
|
|
bcam->sensor_fit = BlenderCamera::AUTO;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else if (b_camera.sensor_fit() == BL::Camera::sensor_fit_HORIZONTAL) {
|
2011-11-05 11:11:06 +00:00
|
|
|
bcam->sensor_fit = BlenderCamera::HORIZONTAL;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2011-11-05 11:11:06 +00:00
|
|
|
bcam->sensor_fit = BlenderCamera::VERTICAL;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-01-17 16:28:43 +01:00
|
|
|
else if (b_ob_data.is_a(&RNA_Light)) {
|
|
|
|
|
/* Can also look through spot light. */
|
|
|
|
|
BL::SpotLight b_light(b_ob_data);
|
|
|
|
|
float lens = 16.0f / tanf(b_light.spot_size() * 0.5f);
|
|
|
|
|
if (lens > 0.0f) {
|
|
|
|
|
bcam->lens = lens;
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-17 16:28:43 +01:00
|
|
|
bcam->motion_steps = object_motion_steps(b_ob, b_ob);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2015-06-22 20:04:46 +02:00
|
|
|
static Transform blender_camera_matrix(const Transform &tfm,
|
|
|
|
|
const CameraType type,
|
|
|
|
|
const PanoramaType panorama_type)
|
2012-04-30 12:49:26 +00:00
|
|
|
{
|
|
|
|
|
Transform result;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
if (type == CAMERA_PANORAMA) {
|
2015-06-22 20:04:46 +02:00
|
|
|
if (panorama_type == PANORAMA_MIRRORBALL) {
|
|
|
|
|
/* Mirror ball camera is looking into the negative Y direction
|
|
|
|
|
* which matches texture mirror ball mapping.
|
|
|
|
|
*/
|
|
|
|
|
result = tfm * make_transform(
|
2018-03-08 06:48:14 +01:00
|
|
|
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
|
2015-06-22 20:04:46 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Make it so environment camera needs to be pointed in the direction
|
|
|
|
|
* of the positive x-axis to match an environment texture, this way
|
|
|
|
|
* it is looking at the center of the texture
|
|
|
|
|
*/
|
|
|
|
|
result = tfm * make_transform(
|
2018-03-08 06:48:14 +01:00
|
|
|
0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-06-22 20:04:46 +02:00
|
|
|
}
|
2012-04-30 12:49:26 +00:00
|
|
|
else {
|
|
|
|
|
/* note the blender camera points along the negative z-axis */
|
|
|
|
|
result = tfm * transform_scale(1.0f, 1.0f, -1.0f);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
return transform_clear_scale(result);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-21 15:36:35 +02:00
|
|
|
static void blender_camera_viewplane(BlenderCamera *bcam,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
BoundBox2D *viewplane,
|
|
|
|
|
float *aspectratio,
|
|
|
|
|
float *sensor_size)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
/* dimensions */
|
2014-05-03 07:22:14 +10:00
|
|
|
float xratio = (float)width * bcam->pixelaspect.x;
|
|
|
|
|
float yratio = (float)height * bcam->pixelaspect.y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* compute x/y aspect and ratio */
|
2012-06-06 23:27:43 +00:00
|
|
|
float xaspect, yaspect;
|
2011-11-05 11:11:06 +00:00
|
|
|
bool horizontal_fit;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
/* sensor fitting */
|
2011-11-05 11:11:06 +00:00
|
|
|
if (bcam->sensor_fit == BlenderCamera::AUTO) {
|
|
|
|
|
horizontal_fit = (xratio > yratio);
|
2015-07-21 15:36:35 +02:00
|
|
|
if (sensor_size != NULL) {
|
|
|
|
|
*sensor_size = bcam->sensor_width;
|
|
|
|
|
}
|
2011-11-05 11:11:06 +00:00
|
|
|
}
|
|
|
|
|
else if (bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
|
|
|
|
|
horizontal_fit = true;
|
2015-07-21 15:36:35 +02:00
|
|
|
if (sensor_size != NULL) {
|
|
|
|
|
*sensor_size = bcam->sensor_width;
|
|
|
|
|
}
|
2011-11-05 11:11:06 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
horizontal_fit = false;
|
2015-07-21 15:36:35 +02:00
|
|
|
if (sensor_size != NULL) {
|
|
|
|
|
*sensor_size = bcam->sensor_height;
|
|
|
|
|
}
|
2011-11-05 11:11:06 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-05 11:11:06 +00:00
|
|
|
if (horizontal_fit) {
|
2015-07-21 15:36:35 +02:00
|
|
|
if (aspectratio != NULL) {
|
|
|
|
|
*aspectratio = xratio / yratio;
|
|
|
|
|
}
|
2012-06-09 18:56:12 +00:00
|
|
|
xaspect = *aspectratio;
|
|
|
|
|
yaspect = 1.0f;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-07-21 15:36:35 +02:00
|
|
|
if (aspectratio != NULL) {
|
|
|
|
|
*aspectratio = yratio / xratio;
|
|
|
|
|
}
|
2012-06-09 18:56:12 +00:00
|
|
|
xaspect = 1.0f;
|
|
|
|
|
yaspect = *aspectratio;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* modify aspect for orthographic scale */
|
2012-02-28 16:44:54 +00:00
|
|
|
if (bcam->type == CAMERA_ORTHOGRAPHIC) {
|
2012-06-06 23:27:43 +00:00
|
|
|
xaspect = xaspect * bcam->ortho_scale / (*aspectratio * 2.0f);
|
|
|
|
|
yaspect = yaspect * bcam->ortho_scale / (*aspectratio * 2.0f);
|
2015-07-21 15:36:35 +02:00
|
|
|
if (aspectratio != NULL) {
|
|
|
|
|
*aspectratio = bcam->ortho_scale / 2.0f;
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
if (bcam->type == CAMERA_PANORAMA) {
|
2021-10-11 20:05:25 +02:00
|
|
|
/* Set viewplane for panoramic camera. */
|
2015-07-21 15:36:35 +02:00
|
|
|
if (viewplane != NULL) {
|
|
|
|
|
*viewplane = bcam->pano_viewplane;
|
2021-10-11 20:05:25 +02:00
|
|
|
|
|
|
|
|
/* Modify viewplane for camera shift. */
|
|
|
|
|
const float shift_factor = (bcam->pano_aspectratio == 0.0f) ?
|
|
|
|
|
1.0f :
|
|
|
|
|
*aspectratio / bcam->pano_aspectratio;
|
|
|
|
|
const float dx = bcam->shift.x * shift_factor;
|
|
|
|
|
const float dy = bcam->shift.y * shift_factor;
|
|
|
|
|
|
|
|
|
|
viewplane->left += dx;
|
|
|
|
|
viewplane->right += dx;
|
|
|
|
|
viewplane->bottom += dy;
|
|
|
|
|
viewplane->top += dy;
|
2015-07-21 15:36:35 +02:00
|
|
|
}
|
2012-02-28 16:44:54 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* set viewplane */
|
2015-07-21 15:36:35 +02:00
|
|
|
if (viewplane != NULL) {
|
|
|
|
|
viewplane->left = -xaspect;
|
|
|
|
|
viewplane->right = xaspect;
|
|
|
|
|
viewplane->bottom = -yaspect;
|
|
|
|
|
viewplane->top = yaspect;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-21 15:36:35 +02:00
|
|
|
/* zoom for 3d camera view */
|
|
|
|
|
*viewplane = (*viewplane) * bcam->zoom;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-21 15:36:35 +02:00
|
|
|
/* modify viewplane with camera shift and 3d camera view offset */
|
2021-10-11 20:05:25 +02:00
|
|
|
const float dx = 2.0f * (*aspectratio * bcam->shift.x + bcam->offset.x * xaspect * 2.0f);
|
|
|
|
|
const float dy = 2.0f * (*aspectratio * bcam->shift.y + bcam->offset.y * yaspect * 2.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-21 15:36:35 +02:00
|
|
|
viewplane->left += dx;
|
|
|
|
|
viewplane->right += dx;
|
|
|
|
|
viewplane->bottom += dy;
|
|
|
|
|
viewplane->top += dy;
|
|
|
|
|
}
|
2012-02-28 16:44:54 +00:00
|
|
|
}
|
2012-06-06 23:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-12 00:50:34 +01:00
|
|
|
static void blender_camera_sync(Camera *cam,
|
|
|
|
|
BlenderCamera *bcam,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const char *viewname,
|
|
|
|
|
PointerRNA *cscene)
|
2012-06-06 23:27:43 +00:00
|
|
|
{
|
|
|
|
|
float aspectratio, sensor_size;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
/* viewplane */
|
2020-11-04 11:17:38 +01:00
|
|
|
BoundBox2D viewplane;
|
|
|
|
|
blender_camera_viewplane(bcam, width, height, &viewplane, &aspectratio, &sensor_size);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_viewplane_left(viewplane.left);
|
|
|
|
|
cam->set_viewplane_right(viewplane.right);
|
|
|
|
|
cam->set_viewplane_top(viewplane.top);
|
|
|
|
|
cam->set_viewplane_bottom(viewplane.bottom);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_full_width(width);
|
|
|
|
|
cam->set_full_height(height);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
/* panorama sensor */
|
2021-12-07 18:54:36 +01:00
|
|
|
if (bcam->type == CAMERA_PANORAMA && (bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID ||
|
|
|
|
|
bcam->panorama_type == PANORAMA_FISHEYE_LENS_POLYNOMIAL))
|
|
|
|
|
{
|
2020-07-28 13:35:19 +02:00
|
|
|
float fit_xratio = (float)bcam->render_width * bcam->pixelaspect.x;
|
|
|
|
|
float fit_yratio = (float)bcam->render_height * bcam->pixelaspect.y;
|
2012-11-23 02:10:13 +00:00
|
|
|
bool horizontal_fit;
|
|
|
|
|
float sensor_size;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
if (bcam->sensor_fit == BlenderCamera::AUTO) {
|
|
|
|
|
horizontal_fit = (fit_xratio > fit_yratio);
|
|
|
|
|
sensor_size = bcam->sensor_width;
|
|
|
|
|
}
|
|
|
|
|
else if (bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
|
|
|
|
|
horizontal_fit = true;
|
|
|
|
|
sensor_size = bcam->sensor_width;
|
|
|
|
|
}
|
2012-11-23 17:39:41 +00:00
|
|
|
else { /* vertical */
|
2012-11-23 02:10:13 +00:00
|
|
|
horizontal_fit = false;
|
|
|
|
|
sensor_size = bcam->sensor_height;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
if (horizontal_fit) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_sensorwidth(sensor_size);
|
|
|
|
|
cam->set_sensorheight(sensor_size * fit_yratio / fit_xratio);
|
2012-11-23 02:10:13 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_sensorwidth(sensor_size * fit_xratio / fit_yratio);
|
|
|
|
|
cam->set_sensorheight(sensor_size);
|
2012-11-23 02:10:13 +00:00
|
|
|
}
|
2012-11-21 01:07:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* clipping distances */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_nearclip(bcam->nearclip);
|
|
|
|
|
cam->set_farclip(bcam->farclip);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
/* type */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_camera_type(bcam->type);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
/* panorama */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_panorama_type(bcam->panorama_type);
|
|
|
|
|
cam->set_fisheye_fov(bcam->fisheye_fov);
|
|
|
|
|
cam->set_fisheye_lens(bcam->fisheye_lens);
|
|
|
|
|
cam->set_latitude_min(bcam->latitude_min);
|
|
|
|
|
cam->set_latitude_max(bcam->latitude_max);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 18:54:36 +01:00
|
|
|
cam->set_fisheye_polynomial_k0(bcam->fisheye_polynomial_k0);
|
|
|
|
|
cam->set_fisheye_polynomial_k1(bcam->fisheye_polynomial_k1);
|
|
|
|
|
cam->set_fisheye_polynomial_k2(bcam->fisheye_polynomial_k2);
|
|
|
|
|
cam->set_fisheye_polynomial_k3(bcam->fisheye_polynomial_k3);
|
|
|
|
|
cam->set_fisheye_polynomial_k4(bcam->fisheye_polynomial_k4);
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_longitude_min(bcam->longitude_min);
|
|
|
|
|
cam->set_longitude_max(bcam->longitude_max);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
/* panorama stereo */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_interocular_distance(bcam->interocular_distance);
|
|
|
|
|
cam->set_convergence_distance(bcam->convergence_distance);
|
|
|
|
|
cam->set_use_spherical_stereo(bcam->use_spherical_stereo);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
if (cam->get_use_spherical_stereo()) {
|
2023-09-17 09:01:48 +10:00
|
|
|
if (strcmp(viewname, "left") == 0) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_stereo_eye(Camera::STEREO_LEFT);
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else if (strcmp(viewname, "right") == 0) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_stereo_eye(Camera::STEREO_RIGHT);
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_stereo_eye(Camera::STEREO_NONE);
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_use_pole_merge(bcam->use_pole_merge);
|
|
|
|
|
cam->set_pole_merge_angle_from(bcam->pole_merge_angle_from);
|
|
|
|
|
cam->set_pole_merge_angle_to(bcam->pole_merge_angle_to);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-08-27 10:51:50 +02:00
|
|
|
/* anamorphic lens bokeh */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_aperture_ratio(bcam->aperture_ratio);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* perspective */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_fov(2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio));
|
|
|
|
|
cam->set_focaldistance(bcam->focaldistance);
|
|
|
|
|
cam->set_aperturesize(bcam->aperturesize);
|
|
|
|
|
cam->set_blades(bcam->apertureblades);
|
|
|
|
|
cam->set_bladesrotation(bcam->aperturerotation);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
/* transform */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_matrix(blender_camera_matrix(bcam->matrix, bcam->type, bcam->panorama_type));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
array<Transform> motion;
|
|
|
|
|
motion.resize(bcam->motion_steps, cam->get_matrix());
|
|
|
|
|
cam->set_motion(motion);
|
|
|
|
|
cam->set_use_perspective_motion(false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_shuttertime(bcam->shuttertime);
|
|
|
|
|
cam->set_fov_pre(cam->get_fov());
|
|
|
|
|
cam->set_fov_post(cam->get_fov());
|
|
|
|
|
cam->set_motion_position(bcam->motion_position);
|
|
|
|
|
|
|
|
|
|
cam->set_rolling_shutter_type(bcam->rolling_shutter_type);
|
|
|
|
|
cam->set_rolling_shutter_duration(bcam->rolling_shutter_duration);
|
|
|
|
|
|
|
|
|
|
cam->set_shutter_curve(bcam->shutter_curve);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
/* border */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_border_left(bcam->border.left);
|
|
|
|
|
cam->set_border_right(bcam->border.right);
|
|
|
|
|
cam->set_border_top(bcam->border.top);
|
|
|
|
|
cam->set_border_bottom(bcam->border.bottom);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_viewport_camera_border_left(bcam->viewport_camera_border.left);
|
|
|
|
|
cam->set_viewport_camera_border_right(bcam->viewport_camera_border.right);
|
|
|
|
|
cam->set_viewport_camera_border_top(bcam->viewport_camera_border.top);
|
|
|
|
|
cam->set_viewport_camera_border_bottom(bcam->viewport_camera_border.bottom);
|
2020-10-27 11:40:42 +01:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
bcam->offscreen_dicing_scale = RNA_float_get(cscene, "offscreen_dicing_scale");
|
|
|
|
|
cam->set_offscreen_dicing_scale(bcam->offscreen_dicing_scale);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sync Render Camera */
|
|
|
|
|
|
2024-02-08 16:49:18 +01:00
|
|
|
static MotionPosition blender_motion_blur_position_type_to_cycles(
|
|
|
|
|
const BL::RenderSettings::motion_blur_position_enum type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case BL::RenderSettings::motion_blur_position_START:
|
|
|
|
|
return MOTION_POSITION_START;
|
|
|
|
|
case BL::RenderSettings::motion_blur_position_CENTER:
|
|
|
|
|
return MOTION_POSITION_CENTER;
|
|
|
|
|
case BL::RenderSettings::motion_blur_position_END:
|
|
|
|
|
return MOTION_POSITION_END;
|
|
|
|
|
}
|
|
|
|
|
/* Could happen if loading a newer file that has an unsupported type. */
|
|
|
|
|
return MOTION_POSITION_CENTER;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
void BlenderSync::sync_camera(BL::RenderSettings &b_render,
|
|
|
|
|
BL::Object &b_override,
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const char *viewname)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
BlenderCamera bcam;
|
2015-03-27 15:47:55 +05:00
|
|
|
blender_camera_init(&bcam, b_render);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* pixel aspect */
|
2013-03-14 07:38:37 +00:00
|
|
|
bcam.pixelaspect.x = b_render.pixel_aspect_x();
|
|
|
|
|
bcam.pixelaspect.y = b_render.pixel_aspect_y();
|
|
|
|
|
bcam.shuttertime = b_render.motion_blur_shutter();
|
2024-02-08 16:49:18 +01:00
|
|
|
bcam.motion_position = blender_motion_blur_position_type_to_cycles(
|
|
|
|
|
b_render.motion_blur_position());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::CurveMapping b_shutter_curve(b_render.motion_blur_shutter_curve());
|
|
|
|
|
curvemapping_to_array(b_shutter_curve, bcam.shutter_curve, RAMP_TABLE_SIZE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-29 17:40:13 +02:00
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2016-02-10 15:09:45 +01:00
|
|
|
bcam.rolling_shutter_type = (Camera::RollingShutterType)get_enum(
|
|
|
|
|
cscene,
|
|
|
|
|
"rolling_shutter_type",
|
|
|
|
|
Camera::ROLLING_SHUTTER_NUM_TYPES,
|
|
|
|
|
Camera::ROLLING_SHUTTER_NONE);
|
2015-11-20 14:42:34 +05:00
|
|
|
bcam.rolling_shutter_duration = RNA_float_get(&cscene, "rolling_shutter_duration");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
/* border */
|
2013-03-14 07:38:37 +00:00
|
|
|
if (b_render.use_border()) {
|
|
|
|
|
bcam.border.left = b_render.border_min_x();
|
|
|
|
|
bcam.border.right = b_render.border_max_x();
|
|
|
|
|
bcam.border.bottom = b_render.border_min_y();
|
|
|
|
|
bcam.border.top = b_render.border_max_y();
|
2012-06-06 23:27:43 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* camera object */
|
|
|
|
|
BL::Object b_ob = b_scene.camera();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (b_override) {
|
2012-04-13 17:42:03 +00:00
|
|
|
b_ob = b_override;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (b_ob) {
|
2015-04-06 10:40:12 -03:00
|
|
|
BL::Array<float, 16> b_ob_matrix;
|
|
|
|
|
blender_camera_from_object(&bcam, b_engine, b_ob);
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
2015-04-06 10:40:12 -03:00
|
|
|
bcam.matrix = get_transform(b_ob_matrix);
|
2022-10-03 19:26:02 +02:00
|
|
|
scene->bake_manager->set_use_camera(b_render.bake().view_from() ==
|
|
|
|
|
BL::BakeSettings::view_from_ACTIVE_CAMERA);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
scene->bake_manager->set_use_camera(false);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* sync */
|
|
|
|
|
Camera *cam = scene->camera;
|
2018-01-12 00:50:34 +01:00
|
|
|
blender_camera_sync(cam, &bcam, width, height, viewname, &cscene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-12 00:50:34 +01:00
|
|
|
/* dicing camera */
|
|
|
|
|
b_ob = BL::Object(RNA_pointer_get(&cscene, "dicing_camera"));
|
|
|
|
|
if (b_ob) {
|
|
|
|
|
BL::Array<float, 16> b_ob_matrix;
|
|
|
|
|
blender_camera_from_object(&bcam, b_engine, b_ob);
|
|
|
|
|
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
|
|
|
|
bcam.matrix = get_transform(b_ob_matrix);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-12 00:50:34 +01:00
|
|
|
blender_camera_sync(scene->dicing_camera, &bcam, width, height, viewname, &cscene);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*scene->dicing_camera = *cam;
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
void BlenderSync::sync_camera_motion(
|
|
|
|
|
BL::RenderSettings &b_render, BL::Object &b_ob, int width, int height, float motion_time)
|
2012-04-30 12:49:26 +00:00
|
|
|
{
|
2023-09-17 09:01:48 +10:00
|
|
|
if (!b_ob) {
|
2015-07-24 21:18:17 +02:00
|
|
|
return;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
Camera *cam = scene->camera;
|
2015-04-06 10:40:12 -03:00
|
|
|
BL::Array<float, 16> b_ob_matrix;
|
2020-11-04 11:17:38 +01:00
|
|
|
b_engine.camera_model_matrix(b_ob, cam->get_use_spherical_stereo(), b_ob_matrix);
|
2015-04-06 10:40:12 -03:00
|
|
|
Transform tfm = get_transform(b_ob_matrix);
|
2020-11-04 11:17:38 +01:00
|
|
|
tfm = blender_camera_matrix(tfm, cam->get_camera_type(), cam->get_panorama_type());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-03-10 01:36:09 +01:00
|
|
|
if (motion_time == 0.0f) {
|
|
|
|
|
/* When motion blur is not centered in frame, cam->matrix gets reset. */
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_matrix(tfm);
|
2018-03-10 01:36:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-03-10 01:36:09 +01:00
|
|
|
/* Set transform in motion array. */
|
|
|
|
|
int motion_step = cam->motion_step(motion_time);
|
|
|
|
|
if (motion_step >= 0) {
|
2020-11-04 11:17:38 +01:00
|
|
|
array<Transform> motion = cam->get_motion();
|
|
|
|
|
motion[motion_step] = tfm;
|
|
|
|
|
cam->set_motion(motion);
|
2012-04-30 12:49:26 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
if (cam->get_camera_type() == CAMERA_PERSPECTIVE) {
|
2015-07-21 15:36:35 +02:00
|
|
|
BlenderCamera bcam;
|
|
|
|
|
float aspectratio, sensor_size;
|
|
|
|
|
blender_camera_init(&bcam, b_render);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-28 11:54:08 +02:00
|
|
|
/* TODO(sergey): Consider making it a part of blender_camera_init(). */
|
|
|
|
|
bcam.pixelaspect.x = b_render.pixel_aspect_x();
|
|
|
|
|
bcam.pixelaspect.y = b_render.pixel_aspect_y();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-07-21 15:36:35 +02:00
|
|
|
blender_camera_from_object(&bcam, b_engine, b_ob);
|
|
|
|
|
blender_camera_viewplane(&bcam, width, height, NULL, &aspectratio, &sensor_size);
|
|
|
|
|
/* TODO(sergey): De-duplicate calculation with camera sync. */
|
|
|
|
|
float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
|
2020-11-04 11:17:38 +01:00
|
|
|
if (fov != cam->get_fov()) {
|
2022-06-16 19:39:13 +02:00
|
|
|
VLOG_WORK << "Camera " << b_ob.name() << " FOV change detected.";
|
2017-08-12 22:04:42 +02:00
|
|
|
if (motion_time == 0.0f) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_fov(fov);
|
2017-08-12 22:04:42 +02:00
|
|
|
}
|
|
|
|
|
else if (motion_time == -1.0f) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_fov_pre(fov);
|
|
|
|
|
cam->set_use_perspective_motion(true);
|
2015-07-21 15:36:35 +02:00
|
|
|
}
|
|
|
|
|
else if (motion_time == 1.0f) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cam->set_fov_post(fov);
|
|
|
|
|
cam->set_use_perspective_motion(true);
|
2015-07-21 15:36:35 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-30 12:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Sync 3D View Camera */
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_view_subset(BL::RenderEngine &b_engine,
|
|
|
|
|
BL::RenderSettings &b_render,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
BL::Object &b_ob,
|
|
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
BoundBox2D *view_box,
|
2021-10-11 20:05:25 +02:00
|
|
|
BoundBox2D *cam_box,
|
|
|
|
|
float *view_aspect);
|
2016-01-30 14:18:29 +01:00
|
|
|
|
|
|
|
|
static void blender_camera_from_view(BlenderCamera *bcam,
|
|
|
|
|
BL::RenderEngine &b_engine,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
bool skip_panorama = false)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
/* 3d view parameters */
|
2012-06-06 23:27:43 +00:00
|
|
|
bcam->nearclip = b_v3d.clip_start();
|
|
|
|
|
bcam->farclip = b_v3d.clip_end();
|
|
|
|
|
bcam->lens = b_v3d.lens();
|
|
|
|
|
bcam->shuttertime = b_scene.render().motion_blur_shutter();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::CurveMapping b_shutter_curve(b_scene.render().motion_blur_shutter_curve());
|
|
|
|
|
curvemapping_to_array(b_shutter_curve, bcam->shutter_curve, RAMP_TABLE_SIZE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA) {
|
|
|
|
|
/* camera view */
|
2019-01-24 17:20:04 +01:00
|
|
|
BL::Object b_ob = (b_v3d.use_local_camera()) ? b_v3d.camera() : b_scene.camera();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (b_ob) {
|
2015-04-06 10:40:12 -03:00
|
|
|
blender_camera_from_object(bcam, b_engine, b_ob, skip_panorama);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-10 22:31:29 +00:00
|
|
|
if (!skip_panorama && bcam->type == CAMERA_PANORAMA) {
|
|
|
|
|
/* in panorama camera view, we map viewplane to camera border */
|
|
|
|
|
BoundBox2D view_box, cam_box;
|
2021-10-11 20:05:25 +02:00
|
|
|
float view_aspect;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::RenderSettings b_render_settings(b_scene.render());
|
|
|
|
|
blender_camera_view_subset(b_engine,
|
|
|
|
|
b_render_settings,
|
|
|
|
|
b_scene,
|
|
|
|
|
b_ob,
|
|
|
|
|
b_v3d,
|
|
|
|
|
b_rv3d,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
&view_box,
|
2021-10-11 20:05:25 +02:00
|
|
|
&cam_box,
|
|
|
|
|
&view_aspect);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-10 22:31:29 +00:00
|
|
|
bcam->pano_viewplane = view_box.make_relative_to(cam_box);
|
2021-10-11 20:05:25 +02:00
|
|
|
bcam->pano_aspectratio = view_aspect;
|
2012-11-10 22:31:29 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* magic zoom formula */
|
|
|
|
|
bcam->zoom = (float)b_rv3d.view_camera_zoom();
|
|
|
|
|
bcam->zoom = (1.41421f + bcam->zoom / 50.0f);
|
|
|
|
|
bcam->zoom *= bcam->zoom;
|
|
|
|
|
bcam->zoom = 2.0f / bcam->zoom;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-10 22:31:29 +00:00
|
|
|
/* offset */
|
|
|
|
|
bcam->offset = get_float2(b_rv3d.view_camera_offset());
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) {
|
|
|
|
|
/* orthographic view */
|
2012-06-09 17:45:22 +00:00
|
|
|
bcam->farclip *= 0.5f;
|
2012-06-06 23:27:43 +00:00
|
|
|
bcam->nearclip = -bcam->farclip;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-24 16:15:46 +00:00
|
|
|
float sensor_size;
|
2023-09-17 09:01:48 +10:00
|
|
|
if (bcam->sensor_fit == BlenderCamera::VERTICAL) {
|
2012-10-24 16:15:46 +00:00
|
|
|
sensor_size = bcam->sensor_height;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-24 16:15:46 +00:00
|
|
|
sensor_size = bcam->sensor_width;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
bcam->type = CAMERA_ORTHOGRAPHIC;
|
2012-10-24 16:15:46 +00:00
|
|
|
bcam->ortho_scale = b_rv3d.view_distance() * sensor_size / b_v3d.lens();
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
bcam->zoom *= 2.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* 3d view transform */
|
2012-06-06 23:27:43 +00:00
|
|
|
bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
|
2020-07-09 16:51:48 +02:00
|
|
|
|
|
|
|
|
/* dimensions */
|
|
|
|
|
bcam->full_width = width;
|
|
|
|
|
bcam->full_height = height;
|
2012-06-06 23:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_view_subset(BL::RenderEngine &b_engine,
|
|
|
|
|
BL::RenderSettings &b_render,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
BL::Object &b_ob,
|
|
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
BoundBox2D *view_box,
|
2021-10-11 20:05:25 +02:00
|
|
|
BoundBox2D *cam_box,
|
|
|
|
|
float *view_aspect)
|
2012-11-10 22:31:29 +00:00
|
|
|
{
|
|
|
|
|
BoundBox2D cam, view;
|
2021-10-11 20:05:25 +02:00
|
|
|
float cam_aspect, sensor_size;
|
2012-11-10 22:31:29 +00:00
|
|
|
|
2020-02-18 10:10:22 +01:00
|
|
|
/* Get viewport viewplane. */
|
2012-11-10 22:31:29 +00:00
|
|
|
BlenderCamera view_bcam;
|
2015-03-27 15:47:55 +05:00
|
|
|
blender_camera_init(&view_bcam, b_render);
|
2015-04-06 10:40:12 -03:00
|
|
|
blender_camera_from_view(&view_bcam, b_engine, b_scene, b_v3d, b_rv3d, width, height, true);
|
2012-11-10 22:31:29 +00:00
|
|
|
|
2021-10-11 20:05:25 +02:00
|
|
|
blender_camera_viewplane(&view_bcam, width, height, &view, view_aspect, &sensor_size);
|
2012-11-10 22:31:29 +00:00
|
|
|
|
2020-02-18 10:10:22 +01:00
|
|
|
/* Get camera viewplane. */
|
2012-11-10 22:31:29 +00:00
|
|
|
BlenderCamera cam_bcam;
|
2015-03-27 15:47:55 +05:00
|
|
|
blender_camera_init(&cam_bcam, b_render);
|
2015-04-06 10:40:12 -03:00
|
|
|
blender_camera_from_object(&cam_bcam, b_engine, b_ob, true);
|
2012-11-10 22:31:29 +00:00
|
|
|
|
2020-02-18 10:10:22 +01:00
|
|
|
/* Camera border is affect by aspect, viewport is not. */
|
|
|
|
|
cam_bcam.pixelaspect.x = b_render.pixel_aspect_x();
|
|
|
|
|
cam_bcam.pixelaspect.y = b_render.pixel_aspect_y();
|
|
|
|
|
|
2012-11-23 02:10:13 +00:00
|
|
|
blender_camera_viewplane(
|
|
|
|
|
&cam_bcam, cam_bcam.full_width, cam_bcam.full_height, &cam, &cam_aspect, &sensor_size);
|
2018-07-06 10:17:58 +02:00
|
|
|
|
2020-02-18 10:10:22 +01:00
|
|
|
/* Return */
|
2021-10-11 20:05:25 +02:00
|
|
|
*view_box = view * (1.0f / *view_aspect);
|
2012-11-10 22:31:29 +00:00
|
|
|
*cam_box = cam * (1.0f / cam_aspect);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_border_subset(BL::RenderEngine &b_engine,
|
|
|
|
|
BL::RenderSettings &b_render,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
BL::Object &b_ob,
|
2015-01-27 21:36:14 +05:00
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const BoundBox2D &border,
|
|
|
|
|
BoundBox2D *result)
|
|
|
|
|
{
|
|
|
|
|
/* Determine camera viewport subset. */
|
|
|
|
|
BoundBox2D view_box, cam_box;
|
2021-10-11 20:05:25 +02:00
|
|
|
float view_aspect;
|
|
|
|
|
blender_camera_view_subset(b_engine,
|
|
|
|
|
b_render,
|
|
|
|
|
b_scene,
|
|
|
|
|
b_ob,
|
|
|
|
|
b_v3d,
|
|
|
|
|
b_rv3d,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
&view_box,
|
|
|
|
|
&cam_box,
|
|
|
|
|
&view_aspect);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-27 21:36:14 +05:00
|
|
|
/* Determine viewport subset matching given border. */
|
|
|
|
|
cam_box = cam_box.make_relative_to(view_box);
|
|
|
|
|
*result = cam_box.subset(border);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
static void blender_camera_border(BlenderCamera *bcam,
|
|
|
|
|
BL::RenderEngine &b_engine,
|
|
|
|
|
BL::RenderSettings &b_render,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2012-06-06 23:27:43 +00:00
|
|
|
{
|
2012-10-16 11:57:46 +00:00
|
|
|
bool is_camera_view;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
/* camera view? */
|
2012-10-16 11:57:46 +00:00
|
|
|
is_camera_view = b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-16 11:57:46 +00:00
|
|
|
if (!is_camera_view) {
|
|
|
|
|
/* for non-camera view check whether render border is enabled for viewport
|
|
|
|
|
* and if so use border from 3d viewport
|
|
|
|
|
* assume viewport has got correctly clamped border already
|
|
|
|
|
*/
|
|
|
|
|
if (b_v3d.use_render_border()) {
|
2012-11-10 22:31:29 +00:00
|
|
|
bcam->border.left = b_v3d.render_border_min_x();
|
|
|
|
|
bcam->border.right = b_v3d.render_border_max_x();
|
|
|
|
|
bcam->border.bottom = b_v3d.render_border_min_y();
|
|
|
|
|
bcam->border.top = b_v3d.render_border_max_y();
|
2012-10-16 11:57:46 +00:00
|
|
|
}
|
2012-06-06 23:27:43 +00:00
|
|
|
return;
|
2015-01-27 21:36:14 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-24 17:20:04 +01:00
|
|
|
BL::Object b_ob = (b_v3d.use_local_camera()) ? b_v3d.camera() : b_scene.camera();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (!b_ob) {
|
2012-06-06 23:27:43 +00:00
|
|
|
return;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-27 21:36:14 +05:00
|
|
|
/* Determine camera border inside the viewport. */
|
|
|
|
|
BoundBox2D full_border;
|
2015-04-06 10:40:12 -03:00
|
|
|
blender_camera_border_subset(b_engine,
|
|
|
|
|
b_render,
|
2015-01-27 21:36:14 +05:00
|
|
|
b_scene,
|
|
|
|
|
b_v3d,
|
|
|
|
|
b_rv3d,
|
|
|
|
|
b_ob,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
full_border,
|
|
|
|
|
&bcam->viewport_camera_border);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-05-31 16:21:24 +02:00
|
|
|
if (b_render.use_border()) {
|
|
|
|
|
bcam->border.left = b_render.border_min_x();
|
|
|
|
|
bcam->border.right = b_render.border_max_x();
|
|
|
|
|
bcam->border.bottom = b_render.border_min_y();
|
|
|
|
|
bcam->border.top = b_render.border_max_y();
|
|
|
|
|
}
|
|
|
|
|
else if (bcam->passepartout_alpha == 1.0f) {
|
|
|
|
|
bcam->border = full_border;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2015-01-27 21:36:14 +05:00
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-27 21:36:14 +05:00
|
|
|
/* Determine viewport subset matching camera border. */
|
2015-04-06 10:40:12 -03:00
|
|
|
blender_camera_border_subset(b_engine,
|
|
|
|
|
b_render,
|
2015-01-27 21:36:14 +05:00
|
|
|
b_scene,
|
|
|
|
|
b_v3d,
|
|
|
|
|
b_rv3d,
|
|
|
|
|
b_ob,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
bcam->border,
|
|
|
|
|
&bcam->border);
|
2016-02-01 10:02:24 +01:00
|
|
|
bcam->border = bcam->border.clamp();
|
2012-06-06 23:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
void BlenderSync::sync_view(BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::RegionView3D &b_rv3d,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2012-06-06 23:27:43 +00:00
|
|
|
{
|
|
|
|
|
BlenderCamera bcam;
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::RenderSettings b_render_settings(b_scene.render());
|
|
|
|
|
blender_camera_init(&bcam, b_render_settings);
|
|
|
|
|
blender_camera_from_view(&bcam, b_engine, b_scene, b_v3d, b_rv3d, width, height);
|
|
|
|
|
blender_camera_border(&bcam, b_engine, b_render_settings, b_scene, b_v3d, b_rv3d, width, height);
|
2018-01-12 00:50:34 +01:00
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
|
|
|
|
blender_camera_sync(scene->camera, &bcam, width, height, "", &cscene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-12 00:50:34 +01:00
|
|
|
/* dicing camera */
|
|
|
|
|
BL::Object b_ob = BL::Object(RNA_pointer_get(&cscene, "dicing_camera"));
|
|
|
|
|
if (b_ob) {
|
|
|
|
|
BL::Array<float, 16> b_ob_matrix;
|
|
|
|
|
blender_camera_from_object(&bcam, b_engine, b_ob);
|
|
|
|
|
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
|
|
|
|
bcam.matrix = get_transform(b_ob_matrix);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-12 00:50:34 +01:00
|
|
|
blender_camera_sync(scene->dicing_camera, &bcam, width, height, "", &cscene);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*scene->dicing_camera = *scene->camera;
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
BufferParams BlenderSync::get_buffer_params(
|
|
|
|
|
BL::SpaceView3D &b_v3d, BL::RegionView3D &b_rv3d, Camera *cam, int width, int height)
|
2011-12-20 12:25:37 +00:00
|
|
|
{
|
|
|
|
|
BufferParams params;
|
2012-10-16 11:57:46 +00:00
|
|
|
bool use_border = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-20 12:25:37 +00:00
|
|
|
params.full_width = width;
|
|
|
|
|
params.full_height = height;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (b_v3d && b_rv3d && b_rv3d.view_perspective() != BL::RegionView3D::view_perspective_CAMERA) {
|
2012-10-16 11:57:46 +00:00
|
|
|
use_border = b_v3d.use_render_border();
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2021-05-31 16:21:24 +02:00
|
|
|
/* the camera can always have a passepartout */
|
|
|
|
|
use_border = true;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-16 11:57:46 +00:00
|
|
|
if (use_border) {
|
2012-06-06 23:27:43 +00:00
|
|
|
/* border render */
|
2015-03-05 15:07:21 +11:00
|
|
|
/* the viewport may offset the border outside the view */
|
|
|
|
|
BoundBox2D border = cam->border.clamp();
|
|
|
|
|
params.full_x = (int)(border.left * (float)width);
|
|
|
|
|
params.full_y = (int)(border.bottom * (float)height);
|
|
|
|
|
params.width = (int)(border.right * (float)width) - params.full_x;
|
|
|
|
|
params.height = (int)(border.top * (float)height) - params.full_y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-13 11:25:36 +00:00
|
|
|
/* survive in case border goes out of view or becomes too small */
|
|
|
|
|
params.width = max(params.width, 1);
|
|
|
|
|
params.height = max(params.height, 1);
|
2011-12-20 12:25:37 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
params.width = width;
|
|
|
|
|
params.height = height;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-09-21 17:03:22 +02:00
|
|
|
params.window_width = params.width;
|
|
|
|
|
params.window_height = params.height;
|
|
|
|
|
|
2011-12-20 12:25:37 +00:00
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|