|
|
On 6/23/2019 6:03 PM, Mike Horvath wrote:
> Starting with location, look_at, angle and sky, I perform the following
> operations:
>
> //--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
>
> #declare Camera_Location = <25.000000,15.000000,-33.000000>;
> #declare Camera_Look_At = <2.000000,2.000000,0.000000>;
> #declare Camera_Angle = 70.000000;
> // should be able to set this to false as well
> #declare Camera_Orthographic = true;
>
> #local CamL = Camera_Location;
> #local CamD = vnormalize(Camera_Look_At - CamL);
> #local CamR = vnormalize(vcross(Camera_Sky, CamD));
> #local CamU = vnormalize(vcross(CamD, CamR));
> #local CamW = vlength(Camera_Look_At - CamL);
>
> #if (Camera_Orthographic = true)
> #local CamR = CamR * CamW;
> #local CamU = CamU * CamW;
> #end
>
> #declare Camera_Zoom = 1/2/tand(Camera_Angle/2) *
> Camera_Aspect_Ratio;
> #declare Camera_Direction = CamD * Camera_Zoom;
> #declare Camera_Right = CamR * Camera_Aspect_Ratio;
> #declare Camera_Up = CamU;
>
> //--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
>
> The code calculates the values of the camera's direction, right and up.
>
> My question is, how do I do the inverse? I.e. starting with location,
> direction, right and up, how do I calculate look_at, angle and sky? It
> seems like pretty simple algebra but I have been hitting my head against
> the wall trying to figure it out.
>
> Thanks.
>
>
> Michael
Disregard. I got it working.
Michael
Post a reply to this message
|
|