POV-Ray : Newsgroups : povray.binaries.images : Re: Ib Rasmussen's Bygning4 rebuilt Server Time
16 Nov 2024 12:25:45 EST (-0500)
  Re: Ib Rasmussen's Bygning4 rebuilt (Message 1 to 1 of 1)  
From: Doctor John
Subject: Re: Ib Rasmussen's Bygning4 rebuilt
Date: 18 Jan 2003 11:22:33
Message: <3e297f49$1@news.povray.org>
"Gilles Tran" <tra### [at] inapginrafr> wrote in message
news:3e24602e@news.povray.org...

> 3e2410ea@news.povray.org...
> > Just thought that you might like to see the difference a field camera
> makes
> > to an architectural scene.
>
> Just in case you missed it, there's a file called "shear.pov" in the 3.5
> distribution that address the "falling buildings" perspective problem and
> shears the camera (it has been written by Fabien Mosen, who is an
> architect).
>
> G.
>
Gilles, I agree that there is such a file, but it only works for views
parallel to one or other of the scene axes.
My original announcement in pov.text.s-f made this very clear. Just in case
you all missed it, I append the text here.
/************************************************************************
This file is a modification of Fabien Mosen's shear.pov which is in the
scenes/camera directory of your standard POVRay distro. Unfortunately, his
solution for "Falling Building Syndrome" only worked if the camera location/
look_at vector lay parallel to the YZ plane (or the XY plane if you moved
his
S_angle constant in the matrix). My algorithm should cure that limitation.
*************************************************************************/

I then made an improvement to the macro to rescale verticals - not always
necessary, but useful in cases where the
camera is pointing up or down at an angle greater than c.15 degrees.

This was posted using this text:

**************************************************************************
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, Rescale)
 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
}
****************************************************************************
/

Apologies to all for not replying earlier, but I've been laid up in bed with
'flu

John
--
Run Fast
Run Free
Run Linux


Post a reply to this message

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