diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-22 21:04:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-22 21:09:52 +0300 |
commit | 211a95b53800b781edc59dbd179a3a20c1a9e445 (patch) | |
tree | c5dc8b4f964ecea8a804a443635203b612052040 /intern | |
parent | a1609791caeacbab0bb580000dae35145469826e (diff) |
Fix T45034: MirrorBall rendering on wrong camera axis
This was a mistake in the original code from D1079.
With the current way how direction ot mirror ball works camera should look
into negative Y direction. Corrected it in the camera matrix synchronization,
so no extra calculations are needed at the render time.
That's a bit annoying, but we'd better port it to the release branch, or
otherwise we'll end up with files created with wrong camera mapping after
2.75 release.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_camera.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index 3d23b5ecea8..90b42ea4ec2 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -207,19 +207,34 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::RenderEngine b_e } } -static Transform blender_camera_matrix(const Transform& tfm, CameraType type) +static Transform blender_camera_matrix(const Transform& tfm, + const CameraType type, + const PanoramaType panorama_type) { Transform result; if(type == CAMERA_PANORAMA) { - /* 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( 0.0f, -1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + 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(1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); + } + 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( 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); + } } else { /* note the blender camera points along the negative z-axis */ @@ -365,7 +380,9 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int cam->bladesrotation = bcam->aperturerotation; /* transform */ - cam->matrix = blender_camera_matrix(bcam->matrix, bcam->type); + cam->matrix = blender_camera_matrix(bcam->matrix, + bcam->type, + bcam->panorama_type); cam->motion.pre = cam->matrix; cam->motion.post = cam->matrix; cam->use_motion = false; @@ -424,7 +441,7 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time) BL::Array<float, 16> b_ob_matrix; b_engine.camera_model_matrix(b_ob, b_ob_matrix); Transform tfm = get_transform(b_ob_matrix); - tfm = blender_camera_matrix(tfm, cam->type); + tfm = blender_camera_matrix(tfm, cam->type, cam->panorama_type); if(tfm != cam->matrix) { VLOG(1) << "Camera " << b_ob.name() << " motion detected."; |