Hi everyone!
I'm currently writing a script which requires me to be able to make the conversions between the different 'Fit Resolution Gate' modes, and have that data in the standard values instead (i.e probably Camera Scale)
The first one I'm trying to calculate is overscan, and then the next will be vertical.
I've been manually plugging in values to try and reverse engineer the forumla, and it's doing my head in. I originally worked out that:
Overscan Scale Value = resX/resY/aspectRatio
When (and only when) the Film Aspect Ratio setting is at 1.5.. however I feel like this is too much of a coincidence to be unrelated. From here I figured I must be missing an unknown variable in the equation, which when the aspect ratio is 1.5, equals 1 if it's a * or / and 0 if it's got something to do with adding and subtracting. From there I've been mucking around with no success..
What I find REALLY confusing is that starting from an aspect ratio of 1 and increasing that number towards 2, the Camera Scale value needed to match the overscan decreases towards a value of 1.. however when you hit around the 2 mark in aspect ratio, the scale value starts increasing again to match the overscan!
If anyone has any information on this (or converting vertical etc) that would be amazing!
Cheers,
Kaine
Edit:
I figure it is also potentially reliant on the focal length as well.
I had to do this a couple years ago in Softimage. You need FOV, and image dimensions. THen you need to calculate the arc tangent information.
u_val is a variable that contains the desired addition pixels around the border.
here is the code for you.
function calc_overshoot( u_val )
{
//var u_val=200;
var userheightaddition = u_val;
t_fov = PPG.FOV ;
t_height = getvalue("Passes.RenderOptions.ImageHeight");
t_width = getvalue("Passes.RenderOptions.ImageWidth");
t_newheight = (t_height + userheightaddition) ;
var x2 = (t_fov /2) * (Math.PI / 180) ;
var x = ( Math.tan(x2) ) * (t_newheight / t_height) ;
var new_fov_radians = (Math.atan(x)) * 2;
var new_fov_degrees = new_fov_radians * (180/Math.PI);
return (new_fov_degrees);
}
to convert fov from horizontal to vertical you can do the following:
myRatio = (height/float(width))
hFOV = cam.fov.value
#convert to radians
hfovRad = deg2rad(hFOV)
#calculate vfov
vfovRad = 2 * math.atan( math.tan(hfovRad/2)*(height/float(width)) )
#convert back to degrees
vfov = rad2deg(vfovRad)
#round up
vfov = math.ceil(vfov)
hopefully you can translate this into maya 😃