Camera FOV not shown in editor correctly?

Hi,
When I set the camera to an FOV of 90, put the editor in top view, and then click the camera, shouldn’t the frustum lines show a full 90 view?

Here’s a screenshot. I put the camera at 45 degree angle, FOV 90, position at origin and the frustum lines are not following the axes lines.

Keep in mind that the ‘Field of view’ field is the vertical field of view, not horizontal; the horizontal field of view is a function of the vertical field of view and the aspect ratio.

As such, I’d guess what you’re seeing is just a product of your editor window’s aspect ratio.

1 Like

Yep, that’s it. Not the ideal way for that to work though…

Thanks for taking time to reply.

Cheers

How is it not ideal? It’s fairly standard for field of view to be measured vertically, and if the vertical and horizontal fields of view aren’t related by way of the aspect ratio, the rendered image will be distorted. Also, if you prefer to specify field of view horizontally, you can easily convert back and forth between horizontal and vertical fields of view as needed.

How would you prefer it to work? (Just curious…)

Of course in game, or when viewing from the camera, by all means do it that way.

But because it’s an editor, showing me the FOV lines should adhere to the FOV I set in the properties otherwise the FOV lines are meaningless. As I move the size of my viewport around it changes. Why show them at all as they don’t serve a purpose now and are just chewing up needless cycles of CPU trying to draw a couple of extra lines.

Instead, if I say I want an FOV of 90, the lines in the editor should show me the boundaries at 90. That way I can use the editor and FOV lines to position things in the level based on when the game is running what the player would see.

I believe the point you’re missing is that the editor /does/ show the gov you’ve set. Vertically, as mentioned. Meaning if you use a side view and rotate your camera up/down 45 degrees, the fov lines would line up with the axes.

Ya, and I’m saying that in a game editor, for most game developers who know what their target screen resolution is, I want to click on a camera and have it show me the frustum bounds I can see. It’s useless to edit a camera’s FOV that is being modified by an editor window. They’re not related at all.

You see, in the editor, it’s a camera looking at a camera. Resizing the window in the editor should mess with the FOV of the editor camera view, not the camera being edited.

All 3D programs work that way. Unity should too. If I go into Max,make a scene, click top view and then adjust my camera FOV it will show me the frustum lines of my scene camera, not of my editing window.

Ok, now I see what you mean. And I have to agree, that’s completely bizarre behavior. The frustum shown in the editor view doesn’t match what’s being show in the game window at all when you resize the latter.

If it matched the currently-set view settings (16:9, etc), that would be acceptable. But currently the frustum resizes even if you keep the same aspect ratio in the game window, but resize it (ie, it’s showing exactly the same volume of space).

I suppose this might be filed as a bug?

We’re aware of the limitation and looking into a good way of solving it. Bothers me to no end as well. :slight_smile:

So it seems the issue is picking an aspect ratio to apply to the camera in the editor view, so that the frustum that’s being viewed can be ‘fixed’ rather than being dependent on the size of the editor window?

The thing is, a lot of games will run at many different resolutions, including resolutions with different aspect ratios. The same game might be run at 4:3 by one person, and 16:9 by another. If you pillar-box it you can get a fixed 4:3, but that’s another decision that has to be made on a per-game basis (that is, not all games will do that - some might just let you have a wider field of view if your monitor has a high aspect ratio).

Following on that, if you want to place things so that they’re ‘just outside’ of the horizontal field of view, you pretty much have to ensure that the game only runs at one aspect ratio (otherwise, there’s not much point in doing that).

As for where to get the aspect ratio from, it doesn’t seem like it would work to get it from the in-editor game window, since its aspect ratio will be unpredictable as well. Maybe a ‘force aspect ratio’ for the camera component would work…

Meanwhile, here’s something you could try if you really need this feature. Just create a script for your camera that draws two rays or lines (using Debug.DrawLine() or DrawRay()) at 45-degree angles from the camera position. (If your camera doesn’t roll, this should be sufficient to give you the reference you’re looking for.)

I reckon the “simple” solution for determining which aspect ratio to use would be to simply default to whatever the Game window is currently set to (via the drop-down: 16:9, 16:10, Web, Standalone, etc). And of course have an option somewhere to force a particular aspect ratio.