Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / ComputeFieldOfView - vertical or horizontal?
  RSS 2.0 ATOM  

ComputeFieldOfView - vertical or horizontal?
Rate this thread
 
61954
 
Permlink of this thread  
avatar
  • Location: Kaunas
  • Total Posts: 32
  • Joined: 11 December 2009 06:23 AM

Hi,

Could you tell me which FOV ComputeFieldOfView returns - vertical or horizontal?

Thanks,
Paulius Liekis
http://unity3d.com
http://pixel-punch.com



Replies: 0
avatar

Hi Paulius,

This method will compute the FOV according to the actual ApertureMode.

Regards,



Viviane Rochon
Maya Data Platform
Autodesk

Replies: 1
/userdata/avatar/86x4dh6ek.jpg

I’m either misusing the method or I don’t understand your answer. What will ComputeFieldOfView return (horizontal or vertical FOV) when ApertureMode is eFOCAL_LENGTH? what if ApertureMode is eHORIZONTAL_AND_VERTICAL?

I have the same question about ComputeFocalLength: which pAngleOfView has to be passed? horizontal or vertical?

Author: Paulius Liekis

Replied: 17 November 2011 08:37 PM  
avatar

Hi Paulius,

here’s how the ComputeFieldOfView function is implemented in FBX 2013.0 right now:

double FbxCamera::ComputeFieldOfView(double pFocalLength) const
{
    
if( pFocalLength == ) return 0.0;

    
double lApertureHeight FilmHeight.Get() * FBXSDK_IN_TO_MM;
    
double lApertureWidth FilmWidth.Get() * FBXSDK_IN_TO_MM;
    if( 
ApertureMode.Get() == eVERTICAL )
    
{
        
return atan((lApertureHeight pFocalLength) * 0.5) * 2.0 FBXSDK_180_DIV_PI;
    
}
    
return atan((lApertureWidth FilmSqueezeRatio.Get() / pFocalLength) * 0.5 ) * 2.0 FBXSDK_180_DIV_PI;
}

ComputeFocalLength is very similar:

double FbxCamera::ComputeFocalLength(double pAngleOfView) const
{
    
if( pAngleOfView == ) return 0.0;

    
double lApertureHeight FilmHeight.Get() * FBXSDK_IN_TO_MM;
    
double lApertureWidth FilmWidth.Get() * FBXSDK_IN_TO_MM;
    if( 
ApertureMode.Get() == eVERTICAL )
    
{
        
return (lApertureHeight tan(pAngleOfView FBXSDK_PI_DIV_180 0.5)) * 0.5;
    
}
    
return (lApertureWidth FilmSqueezeRatio.Get() / tan(pAngleOfView FBXSDK_PI_DIV_180 0.5)) * 0.5;
}

As you can see, we don’t do anything particuliar for the eFOCAL_LENGTH mode, but it seems we handle the vertical case differently from the other modes. Hopefully this help you choose which mode you need to use.



Robert Goulet, FBX Dev Lead

Replies: 1
/userdata/avatar/86x4dh6ek.jpg

Ah I see, so ComputeFieldOfView returns vertical FOV when ApertureMode==eVERTICAL and horizontal FOV when aperture mode is eHORIZONTAL, eHORIZONTAL_AND_VERTICAL or eFOCAL_LENGTH.

It would be great to find such info in the documentation ;)

Thanks,
Paulius

Author: Paulius Liekis

Replied: 21 November 2011 10:04 PM