View Full Version : Output ratios linked to cameras?

12 December 2007, 04:42 PM
Hello all

I was just thinking is there a way of when you switch between cameras in a scene the output ratio's can change .... I have 3 cameras in a scene each has a different output ratios, one is square, one landscape, one portrait .... is there a way of linking the output ratio. and say background object to the camera when I switch cameras I do not have to change the parameters in the render options?

Thanks all


12 December 2007, 10:42 PM
Try this:)
Copy and Paste into a COFFEE Tag on a Camera. Save the Cam with the Tag for later use.


// RatioSetter by tcastudios2007 free to use at your own risk.
// Tested in OSX Intel and R10.5
// Copy all this text into a COFFEE Tag on a Camera object.
// Copy the COFFEE Tag to the Cameras you wish to use.
// For animation rendering you MUST use render to Picture-serie

var newx = 16; // <- Type x-ratio here for this Camera(replace the number only)
var newy = 9; // <- Type y-ratio here for this Camera(replace the number only)

if(newx <= 0 || newy <= 0) return;
if(!op) return;
if(!op->IsInstanceOf(Ocamera)) return;
if(op != doc->GetRenderBaseDraw()#BASEDRAW_DATA_camera ) return;

var bc = doc->GetFirstRenderData()->GetContainer();
var x = bc->GetData(RDATA_XFILM);
var y = bc->GetData(RDATA_YFILM);

if(op == doc->GetRenderBaseDraw()#BASEDRAW_DATA_camera && (x != newx || y != newy) )
bc->SetData(RDATA_XFILM ,float(newx));
bc->SetData(RDATA_YFILM ,float(newy));
println("Output Set To ",newx,":",newy);

12 December 2007, 12:50 AM
It's always nice to see some C.O.F.F.E.E. from the king of cameras. :)

However, I cannot get this to work (WinXP Pro SP2 and C4D R10.506). I put two cameras in the scene, added the C.O.F.F.E.E. tags - one with 16/9 and the other with 4/3 values. The C.O.F.F.E.E. compiles fine, so it's not a cut & paste issue. But when I render to the picture viewer, it seems to ignore the C.O.F.F.E.E. tag settings. Same thing for rendering to the active view.

And changing the Render Settings -> Output -> Film Format to Automatic doesn't seem to help either - it immediately updates to something that doesn't necessarily reflect the tag on the current camera.

I also tried using a stage object and hoped that the camera which I put in there would affect the aspect ratio through the C.O.F.F.E.E. tag, but it doesn't seem to work for me.

Plus, I double-checked all the 'Use' buttons to make sure they weren't accidentally turned off (Use Animation, Use Expressions, Use Generators, Use Deformers) - they were all enabled.

12 December 2007, 01:07 AM
Try the attached scene. It runs as it should here (again, on OSX Intel).


12 December 2007, 01:08 AM
Also double-checked that both C.O.F.F.E.E. tags are definitely enabled and both have Camera Dependent checked.

12 December 2007, 01:20 AM
Hi Lennart,

Thanks for the example scene. It does work with that scene for me. And I can also see the Render Settings -> Output -> Film Format settings updating. I'll try to figure out what the difference might be from what I was doing. I'll post the details if I figure it out. Well maybe not, if it's too embarassing...:D

12 December 2007, 01:49 AM
No problem Jeff.

And just so there is no misunderstanding.
The original intent is to be able to pick different Cameras with different ratios.
The example scene with animated ratios is only a check.
Doing a animated render with switching ratios is not a good idea and Cinema will
most likely use the first Cams ratio setting for the whole animation anyway.


12 December 2007, 07:17 AM
I couldn't resist having a go at this as well. This expression affects all cameras from a single COFFEE tag. The absence of unique object indexing in COFFEE means that each camera must have a unique name.

Lennart's version has the advantages of not requiring unique names and allowing control over which scene cameras are affected.

12 December 2007, 08:56 AM
Is there a way to add the file name and the camera name automatically into the save image path?

It would make working with versions easier to track back the rendering to its original 3D file and fine tuned camera settings...

I'm absolutely not a crack at coffee but this thread seams promising to me. I've been looking for these kind of features for a long time now...

cheers, klueck

12 December 2007, 09:32 AM
Try this:)
Copy and Paste into a COFFEE Tag on a Camera. Save the Cam with the Tag for later use.


Absolutely brilliant..... great... just what I wanted....

thinking ahead though... is it possible in one scene to have 4 camera set ups with different scene components linked to the visible used camera... Say different background images different light set ups and flip between the setups by selecting which camera you look through

Thanks Lennart


12 December 2007, 01:21 AM

Just to put some closure on my earlier issue - it actually wasn't me this time, it was Cinema acting up. I've had the same session open for more than a day now, and tried a bunch of things to figure it out. Eventually, I grabbed one of the handles on the outside of the camera's extents in the viewport and dragged it a little - and then all of the sudden my scene started working. I hit undo a couple of times to make sure its position went back to how it was previously. Still, everything to do with the camera ratios was working. I reverted to the previously saved scene. Even that now worked. I closed Cinema and loaded up an even earlier version of the scene that had also never worked. It too then worked. So this time, it seems like Cinema was just acting flakey. Oh well. Thanks again for the useful scripts, folks.

CGTalk Moderation
12 December 2007, 01:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.