POV-Ray : Newsgroups : povray.general : Look_at hates me Server Time
28 Dec 2024 23:34:01 EST (-0500)
  Look_at hates me (Message 1 to 8 of 8)  
From: Bald Eagle
Subject: Look_at hates me
Date: 21 Aug 2013 04:50:01
Message: <web.52147ec6a1261fe573fc9ebb0@news.povray.org>
.... and I was doing so well.
I got into a groove, and wasn't making ANY mistakes, I banged out a ton of scene
elements THE FIRST TIME, and rapidly converted my ellipse calculations to plot
out camera positions in the scene.

I figured, I'm all set!  I just put the camera in the same positions, and Look
at the center.  NO PROBLEM.  Except the camera isn't looking anywhere at my
green sphere at the center.  :(

Help us, precious.

//####################################################################################
// Animated Camera
//####################################################################################

//Define elliptical orbit
#declare XE1 = 15*Feet;
#declare YE1 = 4*Feet;
#declare ZE1 = 15*Feet;
#declare CenterE1 = <XE1, YE1, ZE1>;
#declare XE1scale = 1;
#declare YE1scale = 1;
#declare ZE1scale = 2/15;
#declare RadiusE1 = 15*Feet;
sphere { 0, 2 pigment { color Green} translate CenterE1}
//torus {RadiusE1, 2 scale z*ZE1scale pigment { color Green} rotate -y*45
translate CenterE1 }

#declare A1 = RadiusE1 * XE1scale;
#declare B1 = RadiusE1 * ZE1scale;
#declare C1 = A1 * B1;
#declare C1E1 = XE1-C1;
#declare C1E2 = XE1+C1;

#declare Clock = 90;

#declare Ellipse1X = cos(radians((Clock/72)*360))*RadiusE1;
#declare Ellipse1Z = sin(radians((Clock/72)*360))*RadiusE1*ZE1scale;

//sphere {<Ellipse1X, 0, Ellipse1Z>, 2 rotate -y*45 translate CenterE1  pigment
{ color Red} }

#declare Camera_Loc = <Ellipse1X, 0, Ellipse1Z> ;
camera {right x*image_width/image_height location Camera_Loc rotate -y*45
translate <XE1, 72, ZE1> look_at CenterE1}
//####################################################################################


Post a reply to this message

From: clipka
Subject: Re: Look_at hates me
Date: 21 Aug 2013 08:33:15
Message: <5214b38b$1@news.povray.org>
Am 21.08.2013 10:48, schrieb Bald Eagle:

> I figured, I'm all set!  I just put the camera in the same positions, and Look
> at the center.  NO PROBLEM.  Except the camera isn't looking anywhere at my
> green sphere at the center.  :(
>
> Help us, precious.
>
>
//####################################################################################
> // Animated Camera
>
//####################################################################################
>
> //Define elliptical orbit
> #declare XE1 = 15*Feet;
> #declare YE1 = 4*Feet;
> #declare ZE1 = 15*Feet;
> #declare CenterE1 = <XE1, YE1, ZE1>;
> #declare XE1scale = 1;
> #declare YE1scale = 1;
> #declare ZE1scale = 2/15;
> #declare RadiusE1 = 15*Feet;
> sphere { 0, 2 pigment { color Green} translate CenterE1}
> //torus {RadiusE1, 2 scale z*ZE1scale pigment { color Green} rotate -y*45
> translate CenterE1 }
>
> #declare A1 = RadiusE1 * XE1scale;
> #declare B1 = RadiusE1 * ZE1scale;
> #declare C1 = A1 * B1;
> #declare C1E1 = XE1-C1;
> #declare C1E2 = XE1+C1;
>
> #declare Clock = 90;
>
> #declare Ellipse1X = cos(radians((Clock/72)*360))*RadiusE1;
> #declare Ellipse1Z = sin(radians((Clock/72)*360))*RadiusE1*ZE1scale;
>
> //sphere {<Ellipse1X, 0, Ellipse1Z>, 2 rotate -y*45 translate CenterE1  pigment
> { color Red} }
>
> #declare Camera_Loc = <Ellipse1X, 0, Ellipse1Z> ;
> camera {right x*image_width/image_height location Camera_Loc rotate -y*45
> translate <XE1, 72, ZE1> look_at CenterE1}
>
//####################################################################################

I have no idea what look_at does when you apply rotations and 
translations first. "Something unexpected" would be my first guess. (I'm 
actually quite surprised it doesn't give you an error message.)

You may want to apply the rotation and translation to Camera_Loc rather 
than the whole camera, like so:

   camera { ...
     location vrotate(Camera_Loc,-y*45)+<XE1,72,ZE1>
     look_at CenterE1
   }


Post a reply to this message

From: Bald Eagle
Subject: Re: Look_at hates me
Date: 21 Aug 2013 09:25:00
Message: <web.5214bf85477db65973fc9ebb0@news.povray.org>
> I have no idea what look_at does when you apply rotations and
> translations first. "Something unexpected" would be my first guess. (I'm
> actually quite surprised it doesn't give you an error message.)

Another POV-Ray misconception ... shattered.  By C. "Thor" Lipka.

I assumed that since I applied those transformations BEFORE the look_at part,
that it would change the camera position, and then look_at would be invoked to
.... look at.

Notsomuch.

Thanks again for disabusing my brain.


Post a reply to this message

From: clipka
Subject: Re: Look_at hates me
Date: 21 Aug 2013 09:42:53
Message: <5214c3dd$1@news.povray.org>
Am 21.08.2013 15:24, schrieb Bald Eagle:
>
>> I have no idea what look_at does when you apply rotations and
>> translations first. "Something unexpected" would be my first guess. (I'm
>> actually quite surprised it doesn't give you an error message.)
>
> I assumed that since I applied those transformations BEFORE the look_at part,
> that it would change the camera position, and then look_at would be invoked to
> ..... look at.

It may give you some consolation that your assumption was perfectly 
reasonable. POV-Ray's camera statement, unfortunately, is not.


Post a reply to this message

From: Le Forgeron
Subject: Re: Look_at hates me
Date: 21 Aug 2013 09:55:01
Message: <5214c6b5$1@news.povray.org>
Le 21/08/2013 15:42, clipka a écrit :
> Am 21.08.2013 15:24, schrieb Bald Eagle:
>>
>>> I have no idea what look_at does when you apply rotations and
>>> translations first. "Something unexpected" would be my first guess. (I'm
>>> actually quite surprised it doesn't give you an error message.)
>>
>> I assumed that since I applied those transformations BEFORE the
>> look_at part,
>> that it would change the camera position, and then look_at would be
>> invoked to
>> ..... look at.
> 
> It may give you some consolation that your assumption was perfectly
> reasonable. POV-Ray's camera statement, unfortunately, is not.
> 

And IIRC the code, it is even sensible to the actual version of the SDL
when the camera is parsed (as well as the type of camera and other side
effect too).

Just play it safe: transform the location vector beforehand, then keep
the camera simple (with or without lookat)

-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

From: Bald Eagle
Subject: Re: Look_at hates me
Date: 21 Aug 2013 12:22:25
Message: <5214e941$1@news.povray.org>
Thanks, guys.
All fixed. (After I fixed dumb 4-am cognitive hallucinatory mathematical 
expressions and a few other loose ends.)


Post a reply to this message

From: Alain
Subject: Re: Look_at hates me
Date: 22 Aug 2013 16:59:06
Message: <52167b9a$1@news.povray.org>


>
> I have no idea what look_at does when you apply rotations and
> translations first. "Something unexpected" would be my first guess. (I'm
> actually quite surprised it doesn't give you an error message.)
>
> You may want to apply the rotation and translation to Camera_Loc rather
> than the whole camera, like so:
>
>    camera { ...
>      location vrotate(Camera_Loc,-y*45)+<XE1,72,ZE1>
>      look_at CenterE1
>    }
>

I've tested it.
Whenever you have any transform of the camera after the look_at, that 
transform will apply to the look_at as well as to the camera's location.
If the look_at point is anywhere but the origin and you rotate the 
camera, it will orbit the origin.
If you translate the camera after the point_at, it will travel while 
keeping it's orientation. It's the same as actualy moving a real word 
camera on some rails.


Post a reply to this message

From: Bald Eagle
Subject: Re: Look_at hates me
Date: 24 Aug 2013 00:15:00
Message: <web.5218328d477db65973fc9ebb0@news.povray.org>
http://news.povray.org/web.521831d7d2090c1d73fc9ebb0%40news.povray.org


Post a reply to this message

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