POV-Ray : Newsgroups : povray.newusers : lens shift camera Server Time
16 May 2024 23:03:17 EDT (-0400)
  lens shift camera (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Reactor
Subject: Re: lens shift camera
Date: 9 Sep 2009 19:35:00
Message: <web.4aa83a7ff237a03d921da9530@news.povray.org>
"tony" <nomail@nomail> wrote:

> camera {
>         FieldCam ()
>         perspective
>         location CamPos
>         angle 49.1343
>         //right 1.33333*x   blender parametter
>         //sky <-0.31737,0.895343,0.312469> blender parametter
>         up y <7.16376,6.23901,-6.19517>
>         transform {NoFall}
>         look_at CamLook
>         }
>
>
> I'm trying to render and make error in "up y" (Parse Error: No matching) in
> 'camera, <found instead.
>
> I'm approaching the process but I do not know what is bad.
>


The line
>         up y <7.16376,6.23901,-6.19517>

POV-ray expects a single vector after up, and you have two:  the y vector, which
is <0,1,0>, and <7.16376,6.23901,-6.19517>.  You should only have one, probably
the second one, since up y is the default for perpendicular camera vectors.
Try removing the y after up but leaving the second vector.


-Reactor


Post a reply to this message

From: Doctor John
Subject: Re: lens shift camera
Date: 10 Sep 2009 06:56:14
Message: <4aa8db4e$1@news.povray.org>
tony wrote:
> Has povray lens shift camera for architecture? How to do?
> 
> Thank you all.
> 
> Tony
> 
> 
As has been mentioned by Stephen, I did a macro a few years back. If
you're having problems with line wrapping, here's the full text:

/**************************************************/
// 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] linuxmailorg>
// Version 3.0 Released May 2006
// History:
//  Version 3.0: 1. Removed necessity of passing parameters when calling
//                  macro. Less typing needed :-)
//               2. Added code so macro can be used when using
//                  right-handed coordinates (i.e. z-axis is up).
//  Version 2.0: 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.

/***********************************************************************
License & copyright:
(c) 2006 John Guthkelch
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. This program is distributed in the hope that
it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
the GNU General Public License for more details.
(See http://www.gnu.org/licenses/gpl.txt for the full GPL text)

***********************************************************************/
#macro FieldCam()
   #local CD=CamLook-CamPos;
   #ifndef (Up_Z)
      #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
    #else
       #if (CD.x!=0 | CD.y!=0) // Note: That's a Boolean OR not an
                               //uppercase i or a lowercase L!
          #local HypoXY=sqrt(pow(CD.x, 2)+pow(CD.y, 2));
          #local VCorr=pow(vlength(CD), 2)/pow(HypoXY, 2);
          #local CosThetaX=CD.x/HypoXY;
          #local CosThetaY=CD.y/HypoXY;
          #if (CD.x=0)
          #local ShearX=0;
       #else
          #local ShearX=(CD.z/CD.x)*pow(CosThetaX, 2);
       #end
       #if (CD.y=0)
          #local ShearY=0;
       #else
          #local ShearY=(CD.z/CD.y)*pow(CosThetaY, 2);
       #end
       #declare NoFall=transform {
          matrix <1, 0, 0, 0, 1, 0, ShearX, ShearY, VCorr, 0, 0, 0>
       }
       #else
         #warning "Viewing vector is perpendicular to XY-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
#end

/*****************USAGE1**********************

#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 Up_Z=1;] // Only use this #declare when using right-handed
coordinates

camera {
        FieldCam ()
        perspective
        location CamPos
        [angle Whatever] // Not essential but can be used
        [right If_you_want] // Also not essential but can be used
        up y | up z //whichever you need
        transform {NoFall}
        look_at CamLook
}
*************USAGE 2**********************
Don't forget to switch vista buffer off by putting Vista_Buffer=0 in
your .ini file or using -uv on the command line.
******************************************************************/

I have never tested the macro on any scenes in which the viewing axes
are anything but either 'up y' or 'up z' so ymmv with your rotated camera.

John
-- 
"Eppur si muove" - Galileo Galilei


Post a reply to this message

From: Doctor John
Subject: Re: lens shift camera
Date: 10 Sep 2009 07:17:41
Message: <4aa8e055$1@news.povray.org>
Additional: When I get home this evening, I'll test with your unusual up
vector. If I hit problems then I'll have an excuse to rewrite the macro
to deal with it (in my copious free time)

John
-- 
"Eppur si muove" - Galileo Galilei


Post a reply to this message

From: Doctor John
Subject: Re: lens shift camera
Date: 11 Sep 2009 06:25:33
Message: <4aaa259d@news.povray.org>
tony wrote:
> Has povray lens shift camera for architecture? How to do?
> 
> Thank you all.
> 
> Tony
> 
> 

OK, Tony, i've now had a chance to play with your code.
Firstly, I don't quite understand why you're using such an unusual up
vector; you run into all sorts of problems with it. I suspect that this
is a product of the conversion process from Blender to Yafray but is
totally unnecessary in Povray. I suggest you read "3.3.1.1.5 Up and
Right Vectors" in the manual to understand why and how they're used.

Secondly, the FieldCam() macro was developed with an assumption that the
majority of people would be using either the standard left-hand system
or, at a pinch, the right-hand system, so you would use 'up y' or 'up z'
respectively. The macro looks at the camera position and the look-at
point and calculates the shearing values to ensure that the image plane
is always parallel to your chosen up vector. Unfortunately in its
present incarnation these vectors can only be <0,1,0> or <0,0,1> so the
camera is acting as if it had a limited shift function i.e it cannot
shift in y and x planes simultaneously. I am thinking about extending
its functionality but the macro would then need a total rewrite.

Lastly, try this in your scene:

#declare CamPos=<7.48113,5.34367,-6.50764>;
#declare CamLook=<6.82627,4.89842,-5.896970>;

camera {
        FieldCam ()
        perspective
        location CamPos
        angle 49.1343
        right (image_width/image_height)*x
        up y
        transform {NoFall}
        look_at CamLook
}
......and don't forget to switch off your vista buffers (-uv on the
command line)

John
-- 
"Eppur si muove" - Galileo Galilei


Post a reply to this message

From: tony
Subject: Re: lens shift camera
Date: 11 Sep 2009 10:40:00
Message: <web.4aaa60d6f237a03d15c9dce10@news.povray.org>
Doctor John:

After reading the documentation and perform various tests I think we are talking
about different things:

1. Camera parameters
2. Lens parameters.

I put several renders with different values of lens shift so you can understand
what I get, if possible with povray:


http://i750.photobucket.com/albums/xx142/tony_p2009/lensshift.jpg

Is it possible on povray?

Thanks.

Tony


Post a reply to this message

From: Doctor John
Subject: Re: lens shift camera
Date: 12 Sep 2009 07:47:17
Message: <4aab8a45@news.povray.org>
tony wrote:
> Doctor John:
> 
> After reading the documentation and perform various tests I think we are talking
> about different things:
> 
> 1. Camera parameters
> 2. Lens parameters.
> 
> I put several renders with different values of lens shift so you can understand
> what I get, if possible with povray:
> 

I don't think we are talking at cross-purposes, and I'll post a few
images to demonstrate what my macro does later ( I'll try to imitate
your test images as much as possible). It may be a couple of days though
as a death in the family has messed things up a bit and I need to
concentrate on that for the moment.

John
-- 
"Eppur si muove" - Galileo Galilei


Post a reply to this message

From: Doctor John
Subject: Re: lens shift camera
Date: 19 Sep 2009 06:58:37
Message: <4ab4b95d@news.povray.org>
Doctor John wrote:
> 
> I don't think we are talking at cross-purposes, and I'll post a few
> images to demonstrate what my macro does later ( I'll try to imitate
> your test images as much as possible). It may be a couple of days though
> as a death in the family has messed things up a bit and I need to
> concentrate on that for the moment.
> 
> John

Sorry for the delay, I've now got what you wanted. See p.b.i for the
first test images. The code for the camera is:
=============================================================

#declare CamPos=<0, 0, -10.5>;
#declare CamLook=<0, 0, 0>;
#declare Distance=vlength(CamLook-CamPos);
#declare ShiftX=0.0; //use whatever numbers you need here n<1
#declare ShiftY=0.0; //use whatever numbers you need here n<1
camera {
	perspective
	location CamPos
	look_at CamLook
	right x*image_width/image_height
	up <0, 1, 0>
	transform {
		matrix
		<1,0,0,
		0,1,0,
		ShiftX,ShiftY,1,
		ShiftX*Distance,ShiftY*Distance,0>
	}
}
==============================================================
I'm going to merge this with my FieldCam work to produce a (close to)
fully functioning studio camera

John
-- 
"Eppur si muove" - Galileo Galilei


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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