@@ -66,7 +66,7 @@ ccl::Camera *convertCommon( const IECoreScene::Camera *camera, const std::string
6666 ccam->fov = M_PI_2;
6767 if ( camera->getFStop () > 0 .0f )
6868 {
69- ccam->aperturesize = camera->getFocalLength () * camera->getFocalLengthWorldScale () / camera->getFStop ();
69+ ccam->aperturesize = 0 . 5f * camera->getFocalLength () * camera->getFocalLengthWorldScale () / camera->getFStop ();
7070 ccam->focaldistance = camera->getFocusDistance ();
7171 }
7272 }
@@ -87,23 +87,24 @@ ccl::Camera *convertCommon( const IECoreScene::Camera *camera, const std::string
8787
8888 // Screen window/resolution TODO: full_ might be something to do with cropping?
8989 const Imath::Box2f &frustum = camera->frustum ();
90- const Imath::V2i &resolution = camera->getResolution ();
90+ const Imath::V2i &resolution = camera->renderResolution ();
9191 const float pixelAspectRatio = camera->getPixelAspectRatio ();
9292 ccam->width = resolution[0 ];
9393 ccam->height = resolution[1 ];
9494 ccam->full_width = resolution[0 ];
9595 ccam->full_height = resolution[1 ];
9696 ccam->viewplane .left = frustum.min .x ;
9797 ccam->viewplane .right = frustum.max .x ;
98- ccam->viewplane .bottom = frustum.min .y ;
99- ccam->viewplane .top = frustum.max .y ;
98+ // Invert the viewplane in Y so Gaffer's aperture offsets and overscan are applied in the correct direction
99+ ccam->viewplane .bottom = -frustum.max .y ;
100+ ccam->viewplane .top = -frustum.min .y ;
100101 ccam->aperture_ratio = pixelAspectRatio; // This is more for the bokeh, maybe it should be a separate parameter?
101102
102103 // Clipping planes
103104 const Imath::V2f &clippingPlanes = camera->getClippingPlanes ();
104105 ccam->nearclip = clippingPlanes.x ;
105106 ccam->farclip = clippingPlanes.y ;
106-
107+
107108 // Crop window
108109 if ( camera->hasCropWindow () )
109110 {
@@ -115,28 +116,9 @@ ccl::Camera *convertCommon( const IECoreScene::Camera *camera, const std::string
115116 ccam->border .clamp ();
116117 }
117118
118- // Shutter TODO: Need to see if this is correct or not, cycles also has a shutter curve...
119+ // Shutter TODO: Cycles also has a shutter curve...
119120 const Imath::V2f &shutter = camera->getShutter ();
120- if ((shutter.x > 0.0 ) && (shutter.y > 0.0 ))
121- {
122- ccam->motion_position = ccl::Camera::MOTION_POSITION_START;
123- ccam->shuttertime = shutter.x + shutter.y ;
124- }
125- else if ((shutter.x < 0.0 ) && (shutter.y > 0.0 ))
126- {
127- ccam->motion_position = ccl::Camera::MOTION_POSITION_CENTER;
128- ccam->shuttertime = abs (shutter.x ) + shutter.y ;
129- }
130- else if ((shutter.x < 0.0 ) && (shutter.y <= 0.0 ))
131- {
132- ccam->motion_position = ccl::Camera::MOTION_POSITION_END;
133- ccam->shuttertime = abs (shutter.x ) + abs (shutter.y );
134- }
135- else
136- {
137- ccam->motion_position = ccl::Camera::MOTION_POSITION_CENTER;
138- ccam->shuttertime = 1.0 ;
139- }
121+ ccam->shuttertime = abs ( shutter.y - shutter.x );
140122
141123 return ccam;
142124}
0 commit comments