Basically, this tutorial is about correcting the imported FBX camera from CRYENGINE Track View. The imported camera initially is not aiming correctly at the right axes. We have to fix it in the progress of this tutorial. Finally, we must also match the FOV value and other camera settings to the CRYENGINE camera view.
From the previous tutorial you exported your animated camera and the scene objects to two separate FBX files..
Frame the CRYENGINE scene objects in your opened viewport to verify they are all imported correctly into 3dsMax (except the CRYENGINE terrain if you didn't add a Area entity into your level).
Your scene objects are probably floating above the XY-plane. You may add a 3dsMax Plane object as a replacement terrain.
Now we need to import the camera animation from the second FBX file. Follow the step 2 to import this FBX camera animation.
Usually, your file exported from Track View of Sandbox Editor has a "MasterCamera" and any additional camera entity you made in CRYENGINE.
You will get one camera, named "MasterCamera", whose transformations does not look correct and a 2nd helper node named "Camera1" which also has your animation data. We will only fix the transformation of the "MasterCamera". This is the main goal we must achieve in the progression of this tutorial:
Re-aligning the imported FBX camera in 3dsMax to match the CRYENGINE camera.
It would be a good assignment, if you also try to fix the transformation of the "Camera1" node. For this you need to add an additional 3dsMax Free camera (the one without the Target node) and align and link it to the "Camera1" transformation.
(img02: FBX scene objects with imported camera whose orientation does not match the CRYENGINE camera.)
In this section, we will add a Rotation List controller with two Euler_XYZ controllers, one which already holds the importd animation and a second which adds some 90° rotational offsets to the "MasterCamera" to its local axes.
Select the "MasterCamera" in a perspective viewport if not done already.
Switch to local coordinate system of the "MasterCamera" by pressing"Alt" key + RightMouseButton-Click in your perspective viewport and choose "Local":
Pay attention to be in LOCAL space/coordinate system when you add the offset rotation to the camera
Now it's time for us to set up the "MasterCamera" in 3dsMax to match the CRYENGINE camera viewport. Remember the FOV/FPS/Camera Resolution in Sandbox Editor we made?
With your "MasterCamera" selected, go to 3dsMax Modify Panel to see the camera parameters we must change.
(img11: Change these 3dsMax camera settings)
Here is a function you can use to convert the CRYENGINE camera FOV to any FOV used by other 3d programs:
function ceFn_convertFOV argWidth argHeight argVerticalFOV =
(
clearListener()
-- convert user input parameters to float values
fVertFOVAngleDeg = argVerticalFOV as float
fWidth = argWidth as float
fHeight = argHeight as float
aspectRatio = undefined
fHorFOVAngleDeg = undefined
iConversionCase = 1
-- FOV conversion calculations
try
(
-- calculate aspect ratio by given pixel width and height of the camera resolution
aspectRatio = fWidth / fHeight
format "\nAspect ratio: %\n" aspectRatio
case (iConversionCase) of
(
1: -- case 1: convert vertical to horizontal FOV
(
fDistance1 = fHeight / (2.0 * tan(fVertFOVAngleDeg / 2.0))
format "\nDistance: %\n" fDistance1
res1 = 2.0 * atan (fWidth / (2.0 * fDistance1))
format "\nconverted horizontal FOV: % \n" res1
fHorFOVAngleDeg = res1
-- case 2: convert horizontal back to vertical FOV for testing the correctness
fDistance2 = fWidth / (2.0 * tan(fHorFOVAngleDeg / 2.0))
format "\nDistance: %\n" fDistance2
res2 = 2.0 * ( atan ( fHeight / (2.0 * fDistance2) ))
format "\nconverted vertical FOV: % \n" res2
-- case 3: convert vertical FOV to diagonal FOV
fDistance3 = fHeight / (2.0 * tan(fVertFOVAngleDeg / 2.0))
format "\nDistance: %\n" fDistance3
fDiagonal = sqrt( (pow fWidth 2) + (pow fHeight 2) )
res3 = 2.0 * ( atan (( fDiagonal / (2.0 * fDistance3) )) )
format "\nconverted diagonal FOV: % " res3
)
)
)
catch
(
messageBox "Exception thrown by ceFn_convertFOV()"
)
)
-- example function call for a resolution of 640 x 480 pixels and a vertical FOV of 60° as used by CRYENGINE Sandbox Editor
ceFn_convertFOV 640 480 60