Thank you, that beautifully explained the relations. It seems so obvious now :)

The final code would be something like,

camera.zoom = d/camera.focus+1;

where d is the distance from the camera to the plane, for those who
are interested.

Thanks,
Andreas

On Thu, Nov 12, 2009 at 7:29 PM, Peter Kapelyan <[email protected]> wrote:
> Hello!
>
> I found these magic formulas in some older threads here:
>
> z = focus*(zoom - 1)
> or
> scale = zoom/(1 + z/focus)
>
> I don't know if that will help you at all, but maybe you could figure it out
> from one of those, otherwise there might be some other formulas dealing with
> zoom and focus, which you'd be able to find if you search for "zoom focus"
> in this group.
>
> Best
> -Peter
>
> On Thu, Nov 12, 2009 at 11:13 AM, Andreas Bruse <[email protected]> wrote:
>>
>> Hi!
>>
>> I've been meaning to write a game, where one important part of the
>> game mechanics would be a switch between a perspective projection and
>> a parallel projection. Now, to make a nice transition between these, I
>> chose not to use the ortho-lense that I've been told exists, but
>> rather change the focus of the camera to a pretty large value, to get
>> an as-good-as parallel projection.
>>
>> The problem, however, is that I want the objects at a certain plane,
>> parallel to the projection plane of the camera to appear as big as
>> they were before the switch of projection. Now, this is where the math
>> starts kicking my ass. I realize, that as I move my focus further back
>> from the projection plane, I would have to zoom out, to keep the
>> points of the specific plane at the same place in the projection. I'm
>> just having problems figuring out by how much.
>>
>> I've been drawing pretty pictures and trying to figure out the
>> relation between the old projection plane and the new one, based on
>> the focus, but failing miserably.
>>
>> So I wonder, is there anyone out there who can point me in the right
>> direction to figure this out? Ideally, I would want to be able to say
>> that a square, parallel to the projection plane and x pixels away from
>> it, should be the same size before and after the transition (and at
>> all points in between), then increase the focus gradually until it is
>> large enough to look like a parallel projection, and at every point
>> adjust the cameras zoom, to keep the square the same size on the
>> screen.
>>
>> Thanks,
>> Andreas
>
>
>
> --
> ___________________
>
> Actionscript 3.0 Flash 3D Graphics Engine
>
> HTTP://AWAY3D.COM
>

Reply via email to