Community
3ds Max Shading, Lighting and Rendering
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max materials topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dimensions for field of view?

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
1703 Views, 15 Replies

Dimensions for field of view?

Hello,

 

I am using a physical camera with the appropriate camera sensor and lens specifications for my application.  I am able to view what the camera is seeing through the Camera Viewport and the Render tools.  However, there seems to be a major feature missing: how can I tell the size of my field of view in length units (inches by inches or mm by mm)?

 

Thanks,

Neil

Labels (1)
15 REPLIES 15
Message 2 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

However, there seems to be a major feature missing: how can I tell the size of my field of view in length units (inches by inches or mm by mm)?

 

Can you clarify what you mean by the size of your FOV in 2 dimensions?  I guess you can't mean Focal Length because that is a one dimensional length reported in mm which is as you probably know is inversely related to the FOV in degrees and is accessible in the Physical Camera modifier panel (Uncheck Specify FOV and it will be easier to see the Focal length). 

 

Maybe you mean the dimensions of the FOV at the Target distance?   

    

Message 3 of 16
Anonymous
in reply to: 10DSpace

Thanks for your comment.  Yes this is exactly what I mean.  I want to know the field-of-view at the targeted distance in terms of a height by width (e.g. 40 mm x 90 mm).  Basically the height times width dimensions of the window that shows what the camera is seeing?   Is this possible without having to manually measure with the ruler or something silly like that?

 

Thanks,

Neil

Message 4 of 16
10DSpace
in reply to: Anonymous

Hi @Anonymous 

 

I want to know the field-of-view at the targeted distance in terms of a height by width (e.g. 40 mm x 90 mm). 

 

This is basically just a trigonometry problem and I recently had written a maxscript for a different but related purpose.  So I adapted the script (see attached) to do the math for you.  The script will report out to you the dimensions of the FOV at the target distance for the selected camera.  It works for standard target cameras and the Physical Camera. 

 

To install the script, unzip and drag the file FOVDimensionsatTargetDistance.mcr to a viewport.  

This will then make the macroscript available (via Customize>Customize User Interface )  and you can place it on a custom toolbar, a custom menu or just hotkey it.   

 

Basically the height times width dimensions of the window that shows what the camera is seeing?

 

Make sure to enable "Show Safe Frames"  in your camera viewport (click on the name of the Camera in the upper left Viewport label for the dropdown)  or your viewport will not match the FOV at the target distance exactly.  This is due to the difference between the aspect ratio of the Max viewport compared to whatever aspect ratio that you have selected in the Render settings dialogue.   Since you seem to be knowledgeable about cameras, you probably already know this but just in case you are not familiar with the Show Safe Frames feature in max...

 

Hope this helps. 

 

 

Message 5 of 16
Anonymous
in reply to: 10DSpace

Hi @10DSpace ,

I am trying to use the script you provided for the same purpose as Neil. Every time I try to execute the script, I receive the following error:

error.PNG

As I do not know much about MAXScript, could you give any insight into why I would be running into this?

Thanks

Message 6 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

How are running the macroscript exactly? Did you follow the installation instructions?  I do not get any errors with Max 2020 and there is built in error correction if you do not have a supported camera (Standard Target camera or Physical camera) selected.   What version of Max are you using and what type of camera do you have selected when you run the script?  

 

 

Message 7 of 16
Anonymous
in reply to: 10DSpace

I followed the installation instructions. I have a custom toolbar I can click. If I don't have a camera selected, the correct message is displayed, but if I select my physical camera I receive the error message I showed. I am currently using Autodesk 3ds Max 2021.

Message 8 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

Sorry about that , but I don't have Max 2021 installed and cannot check the issue.  I did test it in max 2019 also and it works fine. 

 

But does it work with a standard target camera in Max 2021?  That would be an important clue concerning the error message you are getting.

Message 9 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

I just figured out your issue.  For the Physical Camera you have to have "Targeted" checked for the script to work.  The script needs the position of the target for the calculations to figure out the FOV at the Target distance. .  When I unchecked "Targeted" in the basic Tab of the physical Camera rollout, I got the same error message.   Just check "Targeted" for your Physical Camera (it is on by default when you create a Physical Camera) and the script should work fine. 

Message 10 of 16
Anonymous
in reply to: 10DSpace

Hi @10DSpace ,

Thank you for all the help so far! Your suggestion works, although I am working with a lot of untargeted cameras, and it would be ideal in the future to not have to switch to targeted to get the script to work.

Currently, I modified your script so that ' a = getKBValue prompt:"Enter target distance:" ', which allows me to input a number for target distance anytime I run it.

For an untargeted physical camera, a user inputs a target distance under its settings (shown in the image below). Do you know how 3ds Max stores this value and how I might be able to call it? 

Target Distance.PNG

 In your script, ideally, I would just want to set "a" directly to the target distance I inputted when I set up the physical camera (i.e., ' a = StoredTargetDistance ' where StoredTargetDistance is 35.433 in this case)

Message 11 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

Glad you are finding the script useful and are inspired to adapt it to your use.  

 

Do you know how 3ds Max stores this value and how I might be able to call it? ...I would just want to set "a" directly to the target distance I inputted when I set up the physical camera (i.e., ' a = StoredTargetDistance ' where StoredTargetDistance is 35.433 in this case)

 

Very simple:  Once you have collected the selected camera's  desired target distance from the user in variable "a"

the following line will set the target distance to a:

 

$.target_distance = a

 

But you still need to at least temporarily enable "targeted" with the following line for the calculations:

 

$.targeted = true

 

Then at the very end of the script you can disable "Targeted" again if you want it back to untargeted with the line:

 

$.targeted = false

 

If you want to get fancy and just change the Targeted state back to disabled if it was that way to begin with, just set up a test for the state at the beginning of the script and implement that reset with a conditional statement. 

 

As a general maxscript tip if you want to find out what properties are available for an object, just select it and then enter the following in the listener window and hit enter:

 

showProperties $ 

 

Do this for a physical camera and you will the properties mentioned above.

 

Hope this helps. 

 

 

 

 

Message 12 of 16
10DSpace
in reply to: 10DSpace

@Anonymous 

 

Out of curiosity, I meant to ask you what you are doing with the dimensions of the FOV at the target distance?

 

 

Message 13 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

I think I misread your post and that actually what you were saying is that getting the user input via

 

 a = getKBValue prompt:"Enter target distance:" 

 

was just a temporary solution and that you really want to get the value of "a" directly from the Physical Camera target distance field regardless of whether or not targeted is checked.  And that is also easy.  I modified the script accordingly and it now supports either Free or Targeted Standard cameras as well as Physical cameras regardless of of whether targeted is checked or not.   Thanks for asking about this, because it makes the script more generally useful and as mentioned above, I am curious about your use case. 

 

Message 14 of 16
Anonymous
in reply to: 10DSpace

@10DSpace  Thanks a lot for your help on this topic.  @Anonymous  and I are research engineers (we work together) who wanted this tool to ultimately determine field-of-view and the spatial resolution of our optical (and often laser-based) diagnostics measurement set-up (e.g. mm/pix) for various camera positions.

Message 15 of 16
10DSpace
in reply to: Anonymous

@Anonymous 

 

You are welcome.  Interesting use of Max.  Am I safe in assuming that version 2 of the script gave you what you need?

Message 16 of 16
Anonymous
in reply to: 10DSpace

Hi,

 

Version 2 is now giving us what we need. Thanks so much!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report