x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Perspective camera and field of view

I am trying to figure out where to position the camera to view a certain rectangle (of a planar slice) in my scene. I need to do this on the fly so I can't just find a position that works, I need to be able to calculate it. When this didn't seem to work I went back to a very basic test scene and it appears that I do not fully understand how it works. Here is a simple setup:

I have a 100*100*100 cube positioned at (50, 0, 0). This should mean that one of the faces have the four corners (0, -50, -50), (0, 50, -50), (0, 50, 50) and (0, -50, 50), ie a 100*100 square on the X=0 plane. Next I place a camera at (-x, 0, 0) looking in the direction of positive x, towards this face. The question is how far away, ie what must x be, to show the entire height of the face (but no more), like shown in this picture.

camera setup

The vertical field of view for the camera is set to 90 degrees, so the angle up the the camera midline to the upper frustrum should be 45 degrees, and this should view half of the height of the cube face, which is 50, like in this delightful piece of coder art.

coder art

So basic trigonometry should indicate tan(45 deg) = 50 / x, which yields x = 50. However setting the camera x position to -50 does not show the full height of the cube, hand adjusting it seems to end up showing the full height at around -88. Am I completely misunderstanding the camera system?

Product Version: Not Selected
Tags:
camera-1.jpg (19.1 kB)
camera-2.jpg (9.6 kB)
more ▼

asked Apr 28 '14 at 11:45 PM in Using UE4

avatar image

PurrfectPanda
41 3 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Problem solved! Apparently, despite what the tooltip says, the FOV is horizontal.

more ▼

answered May 05 '14 at 12:24 AM

avatar image

PurrfectPanda
41 3 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Actually, FOV is calculated from the widest dimension of the render target (texture).

Say, you have a SceneCapture2D and a target texture. If that texture has dimensions w > h, then further growth of w won't alter horizontal FOV (it remains the same for horizon). Otherwise, if h > w, then the FOV of your SceneCapture2D remains the same for the vertical view. You can test it playing with dimensions of the target texture.

more ▼

answered Apr 04 '16 at 09:00 AM

avatar image

duburlan
102 9 12 21

avatar image saiabinesh Apr 02 '19 at 12:51 PM

I am having a similar problem. I would like to calculate the actual dimensions of my image captured from directly above the scene(aerial top down view). I can get the width (in meter, converting from unreal units) from your above formula using horizontal FOV. But I would also like to get the height of the image in meter. Can you please suggest how I can go about it?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question