POV-Ray : Newsgroups : povray.binaries.images : Question about camera's right vector Server Time
19 Apr 2024 21:55:46 EDT (-0400)
  Question about camera's right vector (Message 1 to 5 of 5)  
From: BayashiPascal
Subject: Question about camera's right vector
Date: 13 Dec 2020 02:30:00
Message: <web.5fd5c20ee1ddd2e62ce8b2430@news.povray.org>
Hi everyone,
Could someone help me understand what's happening in the image attached please ?
I have a camera on the +x axis looking at the origin and a box rotating around
the x axis.
With the default camera (WithRight=0), I obtain what I'm expecting. The +z axis
is toward the right of the image and the box rotates clockwise.
Now if I specify explicitly the right vector of the camera to be like in the
first image toward the +z axis  (WithRight=1), the +z axis is now toward the
left of the image, and the box rotates counter clocwise, but +x still points
toward the camera. I would expect to have the same image as (WithRight=0).
Also, if I set the right vector to -z (WithRight=2), I obtain the same image as
with +z, which is puzzling me, as I would expect it to invert the handedness of
the axes.

Reading the documentation:
http://wiki.povray.org/content/Reference:Camera#Up_and_Right_Vectors
doesn't help me understanding what I'm getting wrong. Could someone help me ?

I paste the code below if you want to try it.

#version 3.7;

background { color rgb 1.0 }

#declare WithRight=0;

#declare cameraPos = 3.0 * x;
#declare cameraLookAt = 0;
camera {
  location cameraPos
  look_at cameraLookAt
#if (WithRight = 1)
  right z * 1.5
#end
#if (WithRight = 2)
  right -z * 1.5
#end
}

light_source {
  100.0
  color rgb 1
}

#declare Target = box {
  <-0.5,-0.5,-0.5>
  <0.5,1,0.5>
  texture {
    pigment {
      color rgb 0.5
    }
  }
}

object {
  Target
  rotate x
  translate -z
}
object {
  Target
  rotate x * 10.0
}
object {
  Target
  rotate x * 20.0
  translate +z
}

union {
  cylinder { 0, x, 0.01 texture {pigment {color x}}}
  cylinder { 0, y, 0.01 texture {pigment {color y}}}
  cylinder { 0, z, 0.01 texture {pigment {color z}}}
  translate x
  no_shadow
}


Post a reply to this message


Attachments:
Download 'axisrot.jpg' (103 KB)

Preview of image 'axisrot.jpg'
axisrot.jpg


 

From: Thomas de Groot
Subject: Re: Question about camera's right vector
Date: 13 Dec 2020 02:48:15
Message: <5fd5c73f$1@news.povray.org>
Op 13/12/2020 om 08:26 schreef BayashiPascal:
> Hi everyone,
> Could someone help me understand what's happening in the image attached please ?
> I have a camera on the +x axis looking at the origin and a box rotating around
> the x axis.
> With the default camera (WithRight=0), I obtain what I'm expecting. The +z axis
> is toward the right of the image and the box rotates clockwise.
> Now if I specify explicitly the right vector of the camera to be like in the
> first image toward the +z axis  (WithRight=1), the +z axis is now toward the
> left of the image, and the box rotates counter clocwise, but +x still points
> toward the camera. I would expect to have the same image as (WithRight=0).
> Also, if I set the right vector to -z (WithRight=2), I obtain the same image as
> with +z, which is puzzling me, as I would expect it to invert the handedness of
> the axes.
> 
> Reading the documentation:
> http://wiki.povray.org/content/Reference:Camera#Up_and_Right_Vectors
> doesn't help me understanding what I'm getting wrong. Could someone help me ?
> 
> I paste the code below if you want to try it.
> 
> #version 3.7;
> 
> background { color rgb 1.0 }
> 
> #declare WithRight=0;
> 
> #declare cameraPos = 3.0 * x;
> #declare cameraLookAt = 0;
> camera {
>    location cameraPos
>    look_at cameraLookAt
> #if (WithRight = 1)
>    right z * 1.5
> #end
> #if (WithRight = 2)
>    right -z * 1.5
> #end
> }
> 
> light_source {
>    100.0
>    color rgb 1
> }
> 
> #declare Target = box {
>    <-0.5,-0.5,-0.5>
>    <0.5,1,0.5>
>    texture {
>      pigment {
>        color rgb 0.5
>      }
>    }
> }
> 
> object {
>    Target
>    rotate x
>    translate -z
> }
> object {
>    Target
>    rotate x * 10.0
> }
> object {
>    Target
>    rotate x * 20.0
>    translate +z
> }
> 
> union {
>    cylinder { 0, x, 0.01 texture {pigment {color x}}}
>    cylinder { 0, y, 0.01 texture {pigment {color y}}}
>    cylinder { 0, z, 0.01 texture {pigment {color z}}}
>    translate x
>    no_shadow
> }
> 

It seems that you have not explicitly added a 'direction' vector. By 
default, it is <0,0,1> where the camera location is pointing along the 
z-axis by default. However, as your camera is pointing towards -x, the 
default direction may have put you in trouble. Try: direction <-1,0,0>

When using non-standard camera settings, do not rely (too much) on the 
default values!

-- 
Thomas


Post a reply to this message

From: BayashiPascal
Subject: Re: Question about camera's right vector
Date: 13 Dec 2020 04:00:01
Message: <web.5fd5d7c4c652136e2ce8b2430@news.povray.org>
Thanks a million Thomas!

Specifying the 'direction' vector as you suggested solved my problem. I was
thinking it's automatically calculated based on the 'location' and 'look_at'
vectors.

Thanks again :-)

(in case you wonder what I'm doing with such non standard settings: I'm working
on a project where the Pov-Ray script is automatically generated by another
program which calculates, among other things, the camera's attitude)

Regards,
Pascal


Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 13/12/2020 om 08:26 schreef BayashiPascal:
> > Hi everyone,
> > Could someone help me understand what's happening in the image attached please ?
> > I have a camera on the +x axis looking at the origin and a box rotating around
> > the x axis.
> > With the default camera (WithRight=0), I obtain what I'm expecting. The +z axis
> > is toward the right of the image and the box rotates clockwise.
> > Now if I specify explicitly the right vector of the camera to be like in the
> > first image toward the +z axis  (WithRight=1), the +z axis is now toward the
> > left of the image, and the box rotates counter clocwise, but +x still points
> > toward the camera. I would expect to have the same image as (WithRight=0).
> > Also, if I set the right vector to -z (WithRight=2), I obtain the same image as
> > with +z, which is puzzling me, as I would expect it to invert the handedness of
> > the axes.
> >
> > Reading the documentation:
> > http://wiki.povray.org/content/Reference:Camera#Up_and_Right_Vectors
> > doesn't help me understanding what I'm getting wrong. Could someone help me ?
> >
> > I paste the code below if you want to try it.
> >
> > #version 3.7;
> >
> > background { color rgb 1.0 }
> >
> > #declare WithRight=0;
> >
> > #declare cameraPos = 3.0 * x;
> > #declare cameraLookAt = 0;
> > camera {
> >    location cameraPos
> >    look_at cameraLookAt
> > #if (WithRight = 1)
> >    right z * 1.5
> > #end
> > #if (WithRight = 2)
> >    right -z * 1.5
> > #end
> > }
> >
> > light_source {
> >    100.0
> >    color rgb 1
> > }
> >
> > #declare Target = box {
> >    <-0.5,-0.5,-0.5>
> >    <0.5,1,0.5>
> >    texture {
> >      pigment {
> >        color rgb 0.5
> >      }
> >    }
> > }
> >
> > object {
> >    Target
> >    rotate x
> >    translate -z
> > }
> > object {
> >    Target
> >    rotate x * 10.0
> > }
> > object {
> >    Target
> >    rotate x * 20.0
> >    translate +z
> > }
> >
> > union {
> >    cylinder { 0, x, 0.01 texture {pigment {color x}}}
> >    cylinder { 0, y, 0.01 texture {pigment {color y}}}
> >    cylinder { 0, z, 0.01 texture {pigment {color z}}}
> >    translate x
> >    no_shadow
> > }
> >
>
> It seems that you have not explicitly added a 'direction' vector. By
> default, it is <0,0,1> where the camera location is pointing along the
> z-axis by default. However, as your camera is pointing towards -x, the
> default direction may have put you in trouble. Try: direction <-1,0,0>
>
> When using non-standard camera settings, do not rely (too much) on the
> default values!
>
> --
> Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: Question about camera's right vector
Date: 14 Dec 2020 02:32:07
Message: <5fd714f7$1@news.povray.org>
Op 13/12/2020 om 09:58 schreef BayashiPascal:
> Thanks a million Thomas!
> 
> Specifying the 'direction' vector as you suggested solved my problem. I was
> thinking it's automatically calculated based on the 'location' and 'look_at'
> vectors.
> 
> Thanks again :-)
> 
> (in case you wonder what I'm doing with such non standard settings: I'm working
> on a project where the Pov-Ray script is automatically generated by another
> program which calculates, among other things, the camera's attitude)
> 
> Regards,
> Pascal
> 
> 

:-)
You are welcome.
I have become attentive to the 'handedness' of external cameras vs 
POV-Ray (left-handed classic), with the use of Moray (right-handed, but 
different) and Silo (right-handed classic).

-- 
Thomas


Post a reply to this message

From: BayashiPascal
Subject: Re: Question about camera's right vector
Date: 14 Dec 2020 03:00:01
Message: <web.5fd71b17c652136e88a71b960@news.povray.org>
The absence of a unique standard is really a pain when one needs to work with
several systems at the same time. I currently have to deal with a mix of
Pov-Ray, Blender, Open3D, RealSense and Universal Robot. It's a mess :-)
Maybe one day in the far future they will all agree on one standard, but I don't
hope to enjoy that moment in my lifetime!


Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 13/12/2020 om 09:58 schreef BayashiPascal:
> > Thanks a million Thomas!
> >
> > Specifying the 'direction' vector as you suggested solved my problem. I was
> > thinking it's automatically calculated based on the 'location' and 'look_at'
> > vectors.
> >
> > Thanks again :-)
> >
> > (in case you wonder what I'm doing with such non standard settings: I'm working
> > on a project where the Pov-Ray script is automatically generated by another
> > program which calculates, among other things, the camera's attitude)
> >
> > Regards,
> > Pascal
> >
> >
>
> :-)
> You are welcome.
> I have become attentive to the 'handedness' of external cameras vs
> POV-Ray (left-handed classic), with the use of Moray (right-handed, but
> different) and Silo (right-handed classic).
>
> --
> Thomas


Post a reply to this message

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