Hi,
this thread has already been very helpful but I need some more
clarification.
I have a standard camera and would like to create an identical VRay Camera.
To match the VrayCam’s fov to the standard’s one works perfectly with
the “fn setFOV f” code that Vlado posted (which utilises the
getViewFOV() command).
Now I would like to calculate that same focal length for the Vray Cam
with the equations posted.
Let’s say I want to match a Standard Camera with a fov of 43.603
(horizontal); then I get with the "setFOV 43.603 " function a focal
length of 44.0683 for the Vray Cam. With that value the Vray Cam matches
perfectly the standard cam.
But if I use the following code, I get to an focal length of 46.2849,
which doesn’t match.
/* Oh an important disclaimer for that function is that it assumes
everything is in millimeters. Here is some example code: */
selCam = $Camera01_VPC
/*--> This is the VRayCam that’s supposed to match to another standard one*/
tempDType = units.DisplayType
tempDMType = units.MetricType
units.DisplayType = #metric
units.MetricType = #millimeters
if selCam.specify_focus==true then (
focDist = units.formatValue(selCam.focus_distance)
) else (
focDist = units.formatValue(selCam.target_distance)
)
units.MetricType = tempDMType
units.DisplayType = tempDType
focDistStr = (substring focDist 1 (focDist.count-2))
focDistStr = substitutestring focDistStr “,” “.”
focDist = focDistStr as float
format “focDist %\n” focDist
/*Max_Focal_Length =
(Focus_Distance)(Focal_Length)/(Focus_Distance-Focal_Length)*/
Max_Focal_Length =
(focDist*(selCam.Focal_Length))/(focDist-selCam.Focal_Length)
format “Max_Focal_Length %\n” Max_Focal_Length
Is the code correct like this? Where is the problem?
thanks,
Lena