# Maya to Playcanvas Perspective Camera

Hi,
I’m working on a 3d based game but using some 2d assets. Can somebody explain the exact relationship between a perspective camera in Playcanvas and Maya’s perspective camera so I can set one up in Maya and do animations that will match the camera angle in Playcanvas exactly?

I’ve been matching the camera framing by eye, but I would like a more objective workflow that will allow me to recreate a Maya perspective camera exactly.

For example, if somebody could just tell me how to figure out the correct value for the “Field Of View” attribute in Playcanvas based on the Maya camera values, that would be perfect.

Thanks,
P-Jinx

Wellp,
I figured it out. For those that come here looking for the solution, I’ll post what I’ve found because it was pretty annoying having to figure this out. So hopefully I can save some people the trouble:

The issue is Maya’s “Angle Of View” attribute is actually horizontal, while “Field Of View” in Playcanvas defaults to vertical.

You can either change the “horizontalFov” attribute to “true” in Playcanvas using code (not sure why it isn’t exposed in the editor. As somebody who doesn’t code much, that sure would have made my life easier) and then just use Maya’s “Angle of View” value.

OR

You can use this formula to convert horizontal field of view to vertical:

2*atan( tan( hFOV/2) * height/ width)

where “height” and “width” refer to your resolution values and “hFOV” is horizontal Field of View (Angle of View in Maya) in radians. Maya gives this value in degrees so you’ll need to convert it. In order to do so, multiply it by π/180, and then after you feed it into the formula, multiply the result by 180/π to convert it back to degrees.

NOTE: since the vertical and horizontal are the same for an aspect ratio of 1.0, you can just feed the Maya Angle Of View value directly into PC’s Field Of View if you are working with a square (like 1024 x 1024 for example).

NOTE 2: keep in mind resizing settings can mess up the 1:1 camera relationship so make sure you have those values set correctly in Playcanvas when you hit play if you need it to line up exactly. (I assume you do or else you wouldn’t be reading this. )

3 Likes

Thanks @p-jinx for sharing!