POV-Ray : Newsgroups : povray.text.scene-files : Improvements to Field Camera macro Server Time
22 Dec 2024 18:32:30 EST (-0500)
  Improvements to Field Camera macro (Message 1 to 2 of 2)  
From: Doctor John
Subject: Improvements to Field Camera macro
Date: 5 Jan 2003 06:35:03
Message: <web.3e181719eebaf7c4b29393de0@news.povray.org>
A few days ago I posted a macro which simulated the properties of an
architectural field camera. Following further testing and responding to
comments from friends who have viewed my test images, I have added a scaling
feature that has the effect of correcting the exaggeration of the apparent
vertical height of the objects being rendered. Mathematically, the theory
used seems sound and the results look good to me but YMMV; consequently, I
have put in a switch to turn the rescaling on and off.
Secondly, I have added error trapping to prevent the "divide by zero" errors
that would occur if the camera was to point parallel to the y-axis.
Finally, I haven't tested this but it seems to me that the "transform
{NoFall}" should be the penultimate and the "look_at CamLook" the final
items in the camera definition - especially if you're using "right
If_you_want".

// 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, RS)
 #local CD=CL-CP;
 #if (CD.x=0 & CD.z=0 & CD.y<0)
  #error "Your camera is pointing vertically down. Please adjust it."
 #else
  #if (CD.x=0 & CD.z=0 & CD.y>0)
   #error "Your camera is pointing vertically up. Please adjust it."
  #end
 #end
 #local HypoXZ=sqrt(pow(CD.x, 2)+pow(CD.z, 2));
 #local VCorr=vlength(CD)/HypoXZ;
 #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
 #if (RS=0)
  #declare NoFall=transform {
   matrix <1, 0, 0, ShearX, 1, ShearZ, 0, 0, 1, 0, 0, 0>
  }
 #else
  #declare NoFall=transform {
   matrix <1, 0, 0, ShearX, VCorr, ShearZ, 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
#declare Rescale=N              //N=1 turns rescaling on, N=0 turns it off

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
}
****************************************************************************/

John
--

Run Fast
Run Free
Run Linux


Post a reply to this message

From: Doctor John
Subject: Re: Improvements to Field Camera macro
Date: 5 Jan 2003 09:20:04
Message: <web.3e183efc669573dbb29393de0@news.povray.org>
Oops!
>
>camera {
> FieldCam (CamPos, CamLook)
> perspective
> location CamPos
I've just realised that I left out a bit....mea culpa, mea culpa, mea maxima
culpa.

camera {
  FieldCam (CamPos, CamLook, Rescale)
  perspective
etc.......
is how the example should read.

John
--

Run Fast
Run Free
Run Linux


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.