camera film back parameters

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/02/2009 at 17:39, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   11 
Platform:      
Language(s) :     C++  ;

---------
We're trying to match a camera move and need to animate a 2D scale on the filmback of the camera. Which C4D parameters would we use for this? I don't see anything under the camera object properties except for zoom, but zoom doesn't appear to be used if the projection type is 'Perspective'.

In Maya we're able to match this camera with a plugin that animates the camera's "post scale" parameter.

Does anyone have any experience with this? Any pointers?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/02/2009 at 21:46, xxxxxxxx wrote:

1. This forum is for Cinema 4D PLUGIN DEVELOPER support (note the 'SDK'), not general Cinema 4D USER support. :)

2. Why Zoom is unavailable in Perspective might be because you use Coord:Scale instead? The reason is not specified in the Help. Best to ask at CGTalk forum or similar.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/02/2009 at 01:08, xxxxxxxx wrote:

In Cinema 4D's perspective camera you zoom by changing the focal length.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/02/2009 at 18:46, xxxxxxxx wrote:

OK, I'm having a hard time getting focal length to work.
Here's a very simple plugin that creates a camera and attempts to set focal length and fov, letting C4D calculate apeture:

> \> Bool spCmd::Execute(BaseDocument\* doc) \> { \>     CameraObject\* cam = CameraObject::Alloc(); \>     cam->SetName("test_cam"); \> \>     BaseContainer\* objData = cam->GetDataInstance(); \> \>     objData->SetLong(CAMERA_PROJECTION, Pperspective); \>     objData->SetReal(CAMERA_FOCUS, 25); \>     objData->SetReal(CAMERAOBJECT_FOV, 52.08); \> \>     doc->InsertObject(cam, NULL, NULL, FALSE); \> \>     cam->Message(MSG_UPDATE); \> \>     return TRUE; \> } \> \>

After executing the plugin, I look at the camera in the attribute manager and see the following:

Focal Length = 25
    Apeture Width = 36
    Field of View = 71.508

Why isn't FOV equal to 52.08 (as set), and Apeture equal to something around 24.4?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/02/2009 at 23:34, xxxxxxxx wrote:

Hey andreaks,

try to add
EventAdd();
after MSG_UPDATE.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/02/2009 at 00:40, xxxxxxxx wrote:

The FOV of Cinema's camera is set by the focal length and the aperture. The aperture of a given FOV and focal length can be calculated like this: aperture = 2.0*focallength*Tangent(FOV/2.0).

Here the modified code:

> \> Bool spCmd::Execute(BaseDocument\* doc) \> { \>     CameraObject\* cam = CameraObject::Alloc(); \>     cam->SetName("test_cam"); \> \>     BaseContainer\* objData = cam->GetDataInstance(); \> \>      Real foclen = 25.0; \>      Real fov = Rad(52.08);     //convert to Radians \>      Real apt = 2.0\*foclen\*Tan(fov/2.0); //aperture = 2.0\*focallength\*Tangent(FOV/2.0) \> \>     objData->SetLong(CAMERA_PROJECTION, Pperspective); \>     objData->SetReal(CAMERA_FOCUS, foclen); \>      objData->SetReal(CAMERAOBJECT_APERTURE, apt); \> \>     doc->InsertObject(cam, NULL, NULL, FALSE); \> \>     doc->Message(MSG_UPDATE); \>      EventAdd(); \> \>     return TRUE; \> } \>

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/02/2009 at 02:24, xxxxxxxx wrote:

whops, i got that completely wrong :D
it really was too early in the morning...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/02/2009 at 15:18, xxxxxxxx wrote:

OK I got it working, thanks everyone. If anyone is interested, here's the final code for converting a camera from Maya to C4D. The "m_" data members hold the values from the Maya camera:

> \> Real aperture = 2.0 \* m_focal_length[f] \* Tan(m_fov[f]/2.0); \> Real adjust2D = m_post_scale[f] / m_overscan[f]; \> Real tmpval; \> \> key = apertureseq->AddKey(currentTime); \> key->SetValue(apertureseq, aperture); \> \> tmpval = m_focal_length[f] \* adjust2D; \> key = focal_lengthseq->AddKey(currentTime); \> key->SetValue(focal_lengthseq, tmpval); \> \> tmpval = (m_offset_x[f]/m_aperture_x[f]) \* adjust2D; \> key = offset_xseq->AddKey(currentTime); \> key->SetValue(offset_xseq, tmpval); \> \> tmpval = (m_offset_y[f]/m_aperture_y[f]) \* adjust2D \* -1.0; \> key = offset_yseq->AddKey(currentTime); \> key->SetValue(offset_yseq, tmpval); \>

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/02/2009 at 08:37, xxxxxxxx wrote:

Thanks for sharing.

cheers,
Matthias