|
![](/i/fill.gif) |
On 4-1-2012 9:49, Le_Forgeron wrote:
> Now... to code that for povray... some camera types (orthographic&
> spherical, even maybe some cylindrical) are just "a tuning away" from
> your need: no need to change the code, just change the parameter such as
> location, up&right for othographic, look_at& angle for spherical.
>
Doctor John wrote the following code (2005). Is that what you need?
Thomas
//start code
// Persistence of Vision SDL include file
// Description: A macro to simulate lens movements in architectural scenes
// Helps prevent the "falling verticals syndrome"
// Author: John Guthkelch (Doctor John) <doc### [at] linuxmail org>
// Version 2.0 Released September 2005
// Changes: 1. Improved warning so that camera automatically reverts to
default
// type if insane values are given for CamPos and/or CamLook
// 2. Corrected silly mathematical error in vertical scaling.This
// is now correct so switch has been taken out.
/***********************************************************************
Don't forget to switch off Vista Buffers by using -uv on the command line
or Vista_Buffer=0 in your .ini file before attempting to render your image
***********************************************************************/
#macro FieldCam (CP, CL)
#local CD=CL-CP;
#if (CD.x!=0 | CD.z!=0) // Note: That's a Boolean OR not an uppercase i
// or a lowercase L!
#local HypoXZ=sqrt(pow(CD.x, 2)+pow(CD.z, 2));
#local VCorr=pow(vlength(CD), 2)/pow(HypoXZ, 2);
#local CosThetaX=CD.x/HypoXZ;
#local CosThetaZ=CD.z/HypoXZ;
#if (CD.x=0)
#local ShearX=0;
#else
#local ShearX=(CD.y/CD.x)*pow(CosThetaX, 2);
#end
#if (CD.z=0)
#local ShearZ=0;
#else
#local ShearZ=(CD.y/CD.z)*pow(CosThetaZ, 2);
#end
#declare NoFall=transform {
matrix <1, 0, 0, ShearX, VCorr, ShearZ, 0, 0, 1, 0, 0, 0>
}
#else
#warning "Viewing vector is perpendicular to XZ-plane.\n"
#warning "Camera changed to default type.\n"
#declare NoFall=transform {
matrix <1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0>
}
#end
#end
/*********************************USAGE**************************************
#declare CamPos=<Xc, Yc, Zc>; //Just replace <Xc,Yc,Zc> with location
vector
#declare CamLook=<Xl, Yl, Zl>; // -"- -"- <Xl,Yl,Zl> with look_at
vector
camera {
FieldCam (CamPos, CamLook)
perspective
location CamPos
[angle Whatever] // Not essential but can be used
[right If_you_want] // Also not essential but can be used
transform {NoFall}
look_at CamLook
}
****************************************************************************/
//end code
Post a reply to this message
|
![](/i/fill.gif) |