Multiple Interlaced variables... like wiring almost


So im working on this camera rig. Turns out that there is a realtionship between the Focal Length, the Aperature Width, and the Field of View… Fancy that, huh? lol.
Here is basically how it works, mathematically:

Field of Vision = 2 * arctan ( aperature / ( 2 * focal_length ) )
Focal Length = aperature / ( 2 * tan ( a / 2 ) )

Here is what the controller section of my script looks like.

parameters main rollout:FoV
		'LinktoCamera' ui:FoVSlider type:#angle deftault:50
rollout FoV "Field of Vision"
	slider FovSlider "Field of Vision" Type:#float Range:[1,175,0] ticks:0
	spinner focal "mm" Type:#float Range:[0.786,2062.596,0]
	spinner angle "deg" Type:#float Range:[0,175,0]
	spinner fstop "aperture" Type:#float Range:[0,100,35]

Now, my question is: without wiring externally, aside from the spinner to be wired the camera’s real FoV, would it be possible to make the Slider and Spinners interact as if they were all wired together? In other words, to make it so if i were to alter ‘focal’, both ‘angle’ and ‘FoVslider’ would update, and likewise, if i were to touch either of the other two, the corrisponding two would change to reflect it?


You should be able to do that with just standard rollout events, like so:

on focal changed val do
	 angle.value = [enter your adjustment code here]
	 fstop.value = [enter your adjustment code here]


If you want the actual camera FOV slider to affect them, you could use change handlers (check callbacks)


Tell me about it :slight_smile:
One of the reasons moving Cameras from Max to Maya is exactly this relationship.

In Max, FOV and focal lenght (Lens) are linked bidirectionally via the Aperture Width - if you change the FOV, the focal lenght is calculated. If you chnange the focal lenght, the FOV is calculated. If you change the Aperture Width, the focal length is changed, while the FOV remains constant.

In Maya, changing the aperture changes the FOV. In addition, other than Max where the FOV is the keyable track but the Focal Length is exposed as an alternative which shows the exactly same keys, Maya can only keyframe the focal length, so when importing animation, if the Aperture settings are wrong and the data stream contains FOV values, the resulting Focal Length animation will be wrong, too (Until this day, FBX fails to do this correctly).

In Maya, the aperture width, aperture height and aspect ratio are one-directionally linked in a mind-boggling fashion, so changing one of them always changes the one you don’t want. It is not possible to set the Aperture Width in Maya, it is calculated via the Aperture Height and the Aspect. So when moving data from Max, one has to calculate the final Aperture Width in inches out of the mm, then divide by the aspect to get the actual Aspect Height in inches, enter that in Maya (the aspect changes based on the old Width and new Height!). Then one has to enter the same Aspect as in Max and lo and behold - the Asperture Width in inches matches the Max’ Aperture Width in mm… :slight_smile:

Of course, Max has also a bit of a fault here - the Aperture Width is exposed as a Renderer setting, while it should have been a Camera property.

So be sure when implementing your internal linking not to make the same mistakes Alias did :wink:


If you can work out a way to wedge what you just said into the 3dsmax wiki, i’d be really grateful Bobo. That is really useful to know.


Bobo, that was confusing, and certainly not because of the way you wrote it.

Now, right now my Aperture is entirely seperated from the Max’s aperture setting. What I’m doing, as of right now is essentially solving for my own total Field of Vision. But, the problem with that is, there are presets in Max for render outputs that shift Max’s aperture settings, throwing my equation out of wack.
Is it possible to Override Max’s aperture settings? or even include them into my script? I tried wiring a parameter to it, but found not a place to wire it to.


I’ve hit a new problem, I’m afraid. It goes something like this:

I select an object with my rollout. It has one parameter called ‘X’ and two UIs: a spinner called ‘A’ and a slider called ‘B’.
Parameter X is linked to slider B.
Spinner A and Slider B are connected by way of this.

on A changed val do
( B.value = A.value )
on B changed val do
( A.value = B.value )

The problem is when I deselect the object and reselect it, the parameter will keep its value and thus so does Slider B, but Spinner A does not, it goes back to its default. Is it possible to keep them linked PERMANENTLY, and not just on a changed value?


I posted too soon, because i figured it out.
under the Range you put the other’s value as the default.

Range: [1,100,B.value]


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.