Aug 12 2006 | 4:39 pm

Hello,

I want to change the lens_angle in a 3d scene, but with the objects

staying the same size, relative to the screen...

There has to be a simple formula for that, but I can't seem to figure

out the relation between object size and lens_angle.

any clues?

brecht.

- Aug 22 2006 | 2:00 amIf you want to change the lens angle but keep the relative size on the screen the same, you must move the object closer or farther away.Using trigonometry, it should be simple to calculate the ratios.sin(theta) = Oposite/adjacentsin(LensAngle) = ( WidthOfObject/2.0 ) / DistanceFromCamerasin(LensAngle) * DistanceFromCamera = ( WidthOfObject/2.0 )sin(LensAngleOld) * DistanceFromCameraOld= ( WidthOfObjectOld/2.0 )sin(LensAngleNew)*DistanceFromCameraNew = ( WidthOfObjectNew/2.0 )since we want the object to stay the same size :WidthOfObjectNew = WidthOfObjectOldsin(LensAngleOld) * DistanceFromCameraOld=sin(LensAngleNew)*DistanceFromCameraNewNow we solve for DistanceFromCameraNew or LensAngleNew. Since the lensangle and distance from camera are related. We must solve for one or the other.LensAngleNew= arcsin(sin(LensAngleOld) * DistanceFromCameraOld/DistanceFromCameraNew )DistanceFromCameraNew = DistanceFromCameraOld * sin(LensAngleOld)/sin(LensAngleNew)For example. If your object is 3 units away from the camera, and your old camera angle was 45.Now lets say you want a new camera angle of 90.you must move the object to3*sin(45)/sin(90)the actual new distance is 2.121The easist way of thinking of this isThe relative distance is sin(oldLensAngle)/sin(NewLensAngle)You should double check my math...
- Aug 23 2006 | 11:18 pmHm, that doesn't seem to work... implemented the little example yougave at the bottom, and the results are different...The first numberbox is the distance, 2nd and 3rd the initial andchanged lens angle.On Aug 22, 2006, at 4:00 AM, Jason Schmitt wrote:>> If you want to change the lens angle but keep the relative size on> the screen the same, you must move the object closer or farther away.>> Using trigonometry, it should be simple to calculate the ratios.>>> sin(theta) = Oposite/adjacent>> sin(LensAngle) = ( WidthOfObject/2.0 ) / DistanceFromCamera>> sin(LensAngle) * DistanceFromCamera = ( WidthOfObject/2.0 )>>> sin(LensAngleOld) * DistanceFromCameraOld= ( WidthOfObjectOld/2.0 )>> sin(LensAngleNew)*DistanceFromCameraNew = ( WidthOfObjectNew/2.0 )>>> since we want the object to stay the same size :> WidthOfObjectNew = WidthOfObjectOld>>>>> sin(LensAngleOld) * DistanceFromCameraOld> => sin(LensAngleNew)*DistanceFromCameraNew>>> Now we solve for DistanceFromCameraNew or LensAngleNew. Since the> lensangle and distance from camera are related. We must solve for> one or the other.>>>> LensAngleNew= arcsin(sin(LensAngleOld) * DistanceFromCameraOld/> DistanceFromCameraNew )>> DistanceFromCameraNew = DistanceFromCameraOld * sin> (LensAngleOld)/sin(LensAngleNew)>>> For example. If your object is 3 units away from the camera, and> your old camera angle was 45.>> Now lets say you want a new camera angle of 90.> you must move the object to>> 3*sin(45)/sin(90)> the actual new distance is 2.121>>> The easist way of thinking of this is>>> The relative distance is sin(oldLensAngle)/sin(NewLensAngle)>>> You should double check my math...>>
- Aug 24 2006 | 5:27 amare you going for the look a 'dolly zoom' or 'trombone effect'? :)best,danOn 8/23/06, Brecht Debackere wrote:> Hm, that doesn't seem to work... implemented the little example you> gave at the bottom, and the results are different...> The first numberbox is the distance, 2nd and 3rd the initial and> changed lens angle.>> #P window setfont "Sans Serif" 9.;> #P window linecount 1;> #P newex 260 302 76 196617 unpack 0. 0. 0.;> #P newex 260 282 61 196617 pak 0. 0. 0.;> #P flonum 332 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;> #P flonum 296 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;> #P flonum 260 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;> #P flonum 260 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;> #P newex 260 323 140 196617 expr $f1* sin($f2)/sin($f3);> #P fasten 6 2 0 2 331 321 395 321;> #P fasten 6 1 0 1 298 321 330 321;> #P connect 6 0 0 0;> #P connect 0 0 1 0;> #P fasten 4 0 5 2 337 277 315 277;> #P fasten 3 0 5 1 301 277 290 277;> #P connect 5 0 6 0;> #P connect 2 0 5 0;> #P window clipboard copycount 7;>> On Aug 22, 2006, at 4:00 AM, Jason Schmitt wrote:> >> > If you want to change the lens angle but keep the relative size on> > the screen the same, you must move the object closer or farther away.> >> > Using trigonometry, it should be simple to calculate the ratios.> >> >> > sin(theta) = Oposite/adjacent> >> > sin(LensAngle) = ( WidthOfObject/2.0 ) / DistanceFromCamera> >> > sin(LensAngle) * DistanceFromCamera = ( WidthOfObject/2.0 )> >> >> > sin(LensAngleOld) * DistanceFromCameraOld= ( WidthOfObjectOld/2.0 )> >> > sin(LensAngleNew)*DistanceFromCameraNew = ( WidthOfObjectNew/2.0 )> >> >> > since we want the object to stay the same size :> > WidthOfObjectNew = WidthOfObjectOld> >> >> >> >> > sin(LensAngleOld) * DistanceFromCameraOld> > => > sin(LensAngleNew)*DistanceFromCameraNew> >> >> > Now we solve for DistanceFromCameraNew or LensAngleNew. Since the> > lensangle and distance from camera are related. We must solve for> > one or the other.> >> >> >> > LensAngleNew= arcsin(sin(LensAngleOld) * DistanceFromCameraOld/> > DistanceFromCameraNew )> >> > DistanceFromCameraNew = DistanceFromCameraOld * sin> > (LensAngleOld)/sin(LensAngleNew)> >> >> > For example. If your object is 3 units away from the camera, and> > your old camera angle was 45.> >> > Now lets say you want a new camera angle of 90.> > you must move the object to> >> > 3*sin(45)/sin(90)> > the actual new distance is 2.121> >> >> > The easist way of thinking of this is> >> >> > The relative distance is sin(oldLensAngle)/sin(NewLensAngle)> >> >> > You should double check my math...> >> >>>--***http://danwinckler.comhttp://share.dj
- Aug 24 2006 | 5:20 pmYep. that's exactly it.On Aug 24, 2006, at 7:27 AM, Dan Winckler wrote:> are you going for the look a 'dolly zoom' or 'trombone effect'? :)>> http://en.wikipedia.org/wiki/Dolly_zoom>> best,> dan>>> On 8/23/06, Brecht Debackere wrote:>> Hm, that doesn't seem to work... implemented the little example you>> gave at the bottom, and the results are different...>> The first numberbox is the distance, 2nd and 3rd the initial and>> changed lens angle.>>>> #P window setfont "Sans Serif" 9.;>> #P window linecount 1;>> #P newex 260 302 76 196617 unpack 0. 0. 0.;>> #P newex 260 282 61 196617 pak 0. 0. 0.;>> #P flonum 332 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;>> #P flonum 296 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;>> #P flonum 260 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;>> #P flonum 260 347 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;>> #P newex 260 323 140 196617 expr $f1* sin($f2)/sin($f3);>> #P fasten 6 2 0 2 331 321 395 321;>> #P fasten 6 1 0 1 298 321 330 321;>> #P connect 6 0 0 0;>> #P connect 0 0 1 0;>> #P fasten 4 0 5 2 337 277 315 277;>> #P fasten 3 0 5 1 301 277 290 277;>> #P connect 5 0 6 0;>> #P connect 2 0 5 0;>> #P window clipboard copycount 7;>>>> On Aug 22, 2006, at 4:00 AM, Jason Schmitt wrote:>> >>> > If you want to change the lens angle but keep the relative size on>> > the screen the same, you must move the object closer or farther>> away.>> >>> > Using trigonometry, it should be simple to calculate the ratios.>> >>> >>> > sin(theta) = Oposite/adjacent>> >>> > sin(LensAngle) = ( WidthOfObject/2.0 ) / DistanceFromCamera>> >>> > sin(LensAngle) * DistanceFromCamera = ( WidthOfObject/2.0 )>> >>> >>> > sin(LensAngleOld) * DistanceFromCameraOld= ( WidthOfObjectOld/2.0 )>> >>> > sin(LensAngleNew)*DistanceFromCameraNew = ( WidthOfObjectNew/2.0 )>> >>> >>> > since we want the object to stay the same size :>> > WidthOfObjectNew = WidthOfObjectOld>> >>> >>> >>> >>> > sin(LensAngleOld) * DistanceFromCameraOld>> > =>> > sin(LensAngleNew)*DistanceFromCameraNew>> >>> >>> > Now we solve for DistanceFromCameraNew or LensAngleNew. Since the>> > lensangle and distance from camera are related. We must solve for>> > one or the other.>> >>> >>> >>> > LensAngleNew= arcsin(sin(LensAngleOld) * DistanceFromCameraOld/>> > DistanceFromCameraNew )>> >>> > DistanceFromCameraNew = DistanceFromCameraOld * sin>> > (LensAngleOld)/sin(LensAngleNew)>> >>> >>> > For example. If your object is 3 units away from the camera, and>> > your old camera angle was 45.>> >>> > Now lets say you want a new camera angle of 90.>> > you must move the object to>> >>> > 3*sin(45)/sin(90)>> > the actual new distance is 2.121>> >>> >>> > The easist way of thinking of this is>> >>> >>> > The relative distance is sin(oldLensAngle)/sin(NewLensAngle)>> >>> >>> > You should double check my math...>> >>> >>>>>>>> --> ***> http://danwinckler.com> http://share.dj> http://idmi.poly.edu>>
- Aug 26 2006 | 7:54 pmYour example uses degrees, but the max Sin trigonometic function needs radians. Try this one instead...