|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I am trying to duplicate the camera angle in a scene with a box mapped
with the image, but when I use certain camera positions and look
combinations, it rotates the image along the z axis. It seems to happen
when the Camera position and look position don't have the same y value.
How can i fix this?
here is a stripped down version. If the "doesn't work' part is commented
out it works fine.
I must admit, I don't always know when to use Reorient_Trans() vs
vrotate() vs VAngleD() and even less how to use them. It gets confusing.
//-----------------------------------//
// begin code
#version 3.7;
global_settings { max_trace_level 5 assumed_gamma 1}
#include "Transforms.inc"
//works:
#declare CamPos= <0.5, 1.5,4.5 >;
#declare CamLook= <1.3,1.5,0>;
///////////////////////////////////
// doesn't work:
#declare CamPos= <0.5, 1.5,4 >;
#declare CamLook= <1.3,1.2,0>;
//////////////////////////////////
#declare CamDirect=<0,0,1>;
#declare CamWidth=image_width;
#declare CamHeight=image_height;
#declare ColMapPig=pigment {image_map { png "test.png" }
translate -0.5*(x+y)
scale <CamWidth/CamHeight,1,1>*2
}
box{<-CamWidth/CamHeight,-1,CamDirect.z>,<CamWidth/CamHeight,1,CamDirect.z+0.001>//}
texture {
pigment {ColMapPig}
finish { ambient 1 diffuse 1}
}
translate CamDirect
Reorient_Trans(z, (CamLook-CamPos))
translate CamPos
}
#declare ColMap="test.png"
///////////////////////////////////////////////////
camera {
location CamPos
direction CamDirect
right x*image_width/image_height
look_at CamLook
}
// End code
//-------------------------//
//--
-Nekar Xenos-
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nekar Xenos wrote:
> How can i fix this?
Have you tried specifying an explicit "up" vector?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Nekar Xenos" <nek### [at] gmailcom> wrote:
> I am trying to duplicate the camera angle in a scene with a box mapped
> with the image, but when I use certain camera positions and look
> combinations, it rotates the image along the z axis. It seems to happen
> when the Camera position and look position don't have the same y value.
>
> How can i fix this?
>
> here is a stripped down version. If the "doesn't work' part is commented
> out it works fine.
>
> I must admit, I don't always know when to use Reorient_Trans() vs
> vrotate() vs VAngleD() and even less how to use them. It gets confusing.
Reorient_Trans() rotates an object so that a given axis is aligned with another
axis by rotating the object around an axis perpendicular to both.
e.g. reorienting the object to align its x axis with it's z axis would rotate it
around y. This is, of course, an extremely trivial example, but you could also
use it to align an axis with a given vector (not sure if it needs to be a
unit-vector or not)
vrotate() simply rotates an object around a vector.
VAngle() and VAngleD() compute the angle between two vectors, the former
returning an angle in radians, the latter returning an angle in degrees.
>
>
> //-----------------------------------//
> // begin code
> #version 3.7;
>
> global_settings { max_trace_level 5 assumed_gamma 1}
>
>
> #include "Transforms.inc"
>
>
> //works:
> #declare CamPos= <0.5, 1.5,4.5 >;
> #declare CamLook= <1.3,1.5,0>;
> ///////////////////////////////////
>
> // doesn't work:
> #declare CamPos= <0.5, 1.5,4 >;
> #declare CamLook= <1.3,1.2,0>;
> //////////////////////////////////
>
> #declare CamDirect=<0,0,1>;
> #declare CamWidth=image_width;
> #declare CamHeight=image_height;
>
> #declare ColMapPig=pigment {image_map { png "test.png" }
> translate -0.5*(x+y)
> scale <CamWidth/CamHeight,1,1>*2
> }
>
> box{<-CamWidth/CamHeight,-1,CamDirect.z>,<CamWidth/CamHeight,1,CamDirect.z+0.001>//}
>
> texture {
> pigment {ColMapPig}
> finish { ambient 1 diffuse 1}
> }
>
>
> translate CamDirect
> Reorient_Trans(z, (CamLook-CamPos))
>
> translate CamPos
> }
>
> #declare ColMap="test.png"
>
> ///////////////////////////////////////////////////
>
> camera {
> location CamPos
> direction CamDirect
> right x*image_width/image_height
> look_at CamLook
> }
> // End code
> //-------------------------//
>
>
> //--
> -Nekar Xenos-
I agree with Christian that you need to specify the up vector in your camera
definition. My default camera is usually something like this: (actually a lot
like yours)
camera {
perspective
location locVect
up y
right x*(image_width/image_height)
look_at lookVect
}
regards,
A.D.B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 15 Aug 2013 16:47:48 +0200, Christian Froeschlin <chr### [at] chrfrde>
wrote:
> Nekar Xenos wrote:
>
>> How can i fix this?
>
> Have you tried specifying an explicit "up" vector?
According to the docs up y is the default camera value.
But that is not the problem. If you add a horizontal plane to this scene,
you will see that it is the box that needs an up y option - not the
camera. I am not quite sure how to simulate that.
--
-Nekar Xenos-
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 15 Aug 2013 18:16:51 +0200, Anthony D. Baye
<Sha### [at] spamnomorehotmailcom> wrote:
> "Nekar Xenos" <nek### [at] gmailcom> wrote:
>> I am trying to duplicate the camera angle in a scene with a box mapped
>> with the image, but when I use certain camera positions and look
>> combinations, it rotates the image along the z axis. It seems to happen
>> when the Camera position and look position don't have the same y value.
>>
>> How can i fix this?
>>
>> here is a stripped down version. If the "doesn't work' part is commented
>> out it works fine.
>>
>> I must admit, I don't always know when to use Reorient_Trans() vs
>> vrotate() vs VAngleD() and even less how to use them. It gets confusing.
>
> Reorient_Trans() rotates an object so that a given axis is aligned with
> another
> axis by rotating the object around an axis perpendicular to both.
>
> e.g. reorienting the object to align its x axis with it's z axis would
> rotate it
> around y. This is, of course, an extremely trivial example, but you
> could also
> use it to align an axis with a given vector (not sure if it needs to be a
> unit-vector or not)
So this is the correct one to use.
>
> vrotate() simply rotates an object around a vector.
Thanks Anthony. The docs don't specify that it is an abject that gets
rotated.
>
> VAngle() and VAngleD() compute the angle between two vectors, the former
> returning an angle in radians, the latter returning an angle in degrees.
>>
>>
>> //-----------------------------------//
>> // begin code
>> #version 3.7;
>>
>> global_settings { max_trace_level 5 assumed_gamma 1}
>>
>>
>> #include "Transforms.inc"
>>
>>
>> //works:
>> #declare CamPos= <0.5, 1.5,4.5 >;
>> #declare CamLook= <1.3,1.5,0>;
>> ///////////////////////////////////
>>
>> // doesn't work:
>> #declare CamPos= <0.5, 1.5,4 >;
>> #declare CamLook= <1.3,1.2,0>;
>> //////////////////////////////////
>>
>> #declare CamDirect=<0,0,1>;
>> #declare CamWidth=image_width;
>> #declare CamHeight=image_height;
>>
>> #declare ColMapPig=pigment {image_map { png "test.png" }
>> translate -0.5*(x+y)
>> scale <CamWidth/CamHeight,1,1>*2
>> }
>>
>>
box{<-CamWidth/CamHeight,-1,CamDirect.z>,<CamWidth/CamHeight,1,CamDirect.z+0.001>//}
>>
>> texture {
>> pigment {ColMapPig}
>> finish { ambient 1 diffuse 1}
>> }
>>
>>
>> translate CamDirect
>> Reorient_Trans(z, (CamLook-CamPos))
>>
>> translate CamPos
>> }
>>
>> #declare ColMap="test.png"
>>
>> ///////////////////////////////////////////////////
>>
>> camera {
>> location CamPos
>> direction CamDirect
>> right x*image_width/image_height
>> look_at CamLook
>> }
>> // End code
>> //-------------------------//
>>
>>
>> //--
>> -Nekar Xenos-
>
> I agree with Christian that you need to specify the up vector in your
> camera
> definition. My default camera is usually something like this: (actually
> a lot
> like yours)
>
> camera {
> perspective
> location locVect
> up y
> right x*(image_width/image_height)
> look_at lookVect
> }
>
> regards,
> A.D.B.
>
This makes no difference. In this case my object needs an "up y" option :S
--
-Nekar Xenos-
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Nekar Xenos" <nek### [at] gmailcom> wrote:
> On Thu, 15 Aug 2013 18:16:51 +0200, Anthony D. Baye
> <Sha### [at] spamnomorehotmailcom> wrote:
>
> > "Nekar Xenos" <nek### [at] gmailcom> wrote:
> >> I am trying to duplicate the camera angle in a scene with a box mapped
> >> with the image, but when I use certain camera positions and look
> >> combinations, it rotates the image along the z axis. It seems to happen
> >> when the Camera position and look position don't have the same y value.
> >>
> >> How can i fix this?
> >>
> >> here is a stripped down version. If the "doesn't work' part is commented
> >> out it works fine.
> >>
> >> I must admit, I don't always know when to use Reorient_Trans() vs
> >> vrotate() vs VAngleD() and even less how to use them. It gets confusing.
> >
> > Reorient_Trans() rotates an object so that a given axis is aligned with
> > another
> > axis by rotating the object around an axis perpendicular to both.
> >
> > e.g. reorienting the object to align its x axis with it's z axis would
> > rotate it
> > around y. This is, of course, an extremely trivial example, but you
> > could also
> > use it to align an axis with a given vector (not sure if it needs to be a
> > unit-vector or not)
>
> So this is the correct one to use.
>
> >
> > vrotate() simply rotates an object around a vector.
> Thanks Anthony. The docs don't specify that it is an abject that gets
> rotated.
>
well... What it actually does, is rotate a point A around the origin by a given
amount B. -- Sorry, I misread, and was thinking of vaxis_rotate(...).
so you could use it like this:
object {
...
translate vrotate(A, B)
}
vaxis_rotate(A,B,F) does what I said. Where A is, again, a point in space, B is
a vector around which A is rotated by an amount F.
you would use it in the same way as vrotate.
Regards,
A.D.B.
regards
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I should also be clear that with vrotate(A,B), B is also a vector. So:
object {
...
translate vrotate(A, B)
}
is the same as:
object {
...
translate A
rotate B
}
Regards,
A.D.B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 16.08.2013 06:27, schrieb Anthony D. Baye:
> I should also be clear that with vrotate(A,B), B is also a vector. So:
>
> object {
> ...
> translate vrotate(A, B)
> }
>
> is the same as:
>
> object {
> ...
> translate A
> rotate B
> }
Nope. It's rather like
rotate <0,0,-B.z>
rotate <0,-B.y,0>
rotate <-B.x,0,0>
translate A
rotate B
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> Am 16.08.2013 06:27, schrieb Anthony D. Baye:
> > I should also be clear that with vrotate(A,B), B is also a vector. So:
> >
> > object {
> > ...
> > translate vrotate(A, B)
> > }
> >
> > is the same as:
> >
> > object {
> > ...
> > translate A
> > rotate B
> > }
>
> Nope. It's rather like
>
> rotate <0,0,-B.z>
> rotate <0,-B.y,0>
> rotate <-B.x,0,0>
> translate A
> rotate B
Then the documentation needs serious clarification. That is not mentioned at
all.
http://www.povray.org/documentation/view/3.7.0/229/
From: Pov-Ray documentation 2.2.1.4 Vector Expressions --
"vrotate(A,B) Rotate A about origin by B. Given the x,y,z coordinates of a point
in space designated by the vector A, rotate that point about the origin by an
amount specified by the vector B. Rotate it about the x-axis by an angle
specified in degrees by the float value B.x. Similarly B.y and B.z specify the
amount to rotate in degrees about the y-axis and z-axis. The result is a vector
containing the new x,y,z coordinates of the point."
Regards,
A.D.B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 16.08.2013 06:27, schrieb Anthony D. Baye:
> > > I should also be clear that with vrotate(A,B), B is also a vector. So:
> > >
> > > object {
> > > ...
> > > translate vrotate(A, B)
> > > }
> > >
> > > is the same as:
> > >
> > > object {
> > > ...
> > > translate A
> > > rotate B
> > > }
> >
> > Nope. It's rather like
> >
> > rotate <0,0,-B.z>
> > rotate <0,-B.y,0>
> > rotate <-B.x,0,0>
> > translate A
> > rotate B
>
> Then the documentation needs serious clarification. That is not mentioned at
> all.
>
> http://www.povray.org/documentation/view/3.7.0/229/
>
> From: Pov-Ray documentation 2.2.1.4 Vector Expressions --
> "vrotate(A,B) Rotate A about origin by B. Given the x,y,z coordinates of a point
> in space designated by the vector A, rotate that point about the origin by an
> amount specified by the vector B. Rotate it about the x-axis by an angle
> specified in degrees by the float value B.x. Similarly B.y and B.z specify the
> amount to rotate in degrees about the y-axis and z-axis. The result is a vector
> containing the new x,y,z coordinates of the point."
>
> Regards,
> A.D.B.
see example in p.b.i
Regards,
A.D.B
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|