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 / Bug in ViewScene example: fieldOfViewY is calculated incorrectly
  RSS 2.0 ATOM  

Bug in ViewScene example: fieldOfViewY is calculated incorrectly
Rate this thread
 
53651
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 24 March 2011 08:48 PM

Hello,

There is a bug in SetCamera.cxx which causes cameras to display incorrectly. The problem lies in the SetCamera() function, where it is determining the lFieldOfViewY. Here is a code snippet of the problem area (I’m using FBX SDK 2011):

else if (lCamera->GetApertureMode() == KFbxCamera::eFOCAL_LENGTH{
            lFieldOfViewY 
lCamera->ComputeFieldOfView(lCamera->FocalLength.Get());
            
lFieldOfViewY /= lAspect;
        
}

This is simply wrong: you can’t just divide the horizontal angle by the aspect ratio in order to get the vertical angle. Here is the corrected code:

else if (lCamera->GetApertureMode() == KFbxCamera::eFOCAL_LENGTH{
            double halfApertureYinMM 
lCamera->GetApertureHeight() * 25.4 2;
            
double halfAngleInRad atan(halfApertureYinMM lCamera->FocalLength.Get());
            
lFieldOfViewY 2*MathUtil::rad2deg(halfAngleInRad);
        
}

I expect the same problem exists a few lines further up, in the same function:

if (lCamera->GetApertureMode() == KFbxCamera::eHORIZONTAL)
                    
lFieldOfViewY /= lAspect;

and would be fixed the same way.

Cheers,
Russ MacKenzie



Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

Hello Russ,
I checked the newest code and saw this part is already changed.
Please check it in our next release.
Thanks a lot for reporting!

Author: Jiayang Xu

Replied: 24 March 2011 11:53 PM