POV-Ray : Newsgroups : povray.animations : How to align objects to camera. Server Time
23 Nov 2024 12:06:20 EST (-0500)
  How to align objects to camera. (Message 1 to 8 of 8)  
From: Allen
Subject: How to align objects to camera.
Date: 15 Jan 2009 00:40:01
Message: <web.496ecaad4b0681c28f162dfb0@news.povray.org>
I have an animation which the camera is moving through the scene.  However,
certain objects are to remain aligned to the camera as if the camera was at <0,
0, 0> with right in the +x direction and up in the +y direction and looking
along +z.  How can I take an object(s) and transform them based on the camera's
current position, angle, etc to achieve this?


Post a reply to this message

From: Bob Hughes
Subject: Re: How to align objects to camera.
Date: 15 Jan 2009 03:12:40
Message: <496eeff8$1@news.povray.org>
"Allen" <bri### [at] yahoocom> wrote in message 
news:web.496ecaad4b0681c28f162dfb0@news.povray.org...
>I have an animation which the camera is moving through the scene.  However,
> certain objects are to remain aligned to the camera as if the camera was 
> at <0,
> 0, 0> with right in the +x direction and up in the +y direction and 
> looking
> along +z.  How can I take an object(s) and transform them based on the 
> camera's
> current position, angle, etc to achieve this?


Not absolutely positive about this but maybe you could change 
splinefollow.pov example scene (scenes\animations subfolder) to be opposite. 
Camera as object and object as camera...?

Bob


Post a reply to this message

From: Allen
Subject: Re: How to align objects to camera.
Date: 15 Jan 2009 03:45:01
Message: <web.496ef6d925793fec8f162dfb0@news.povray.org>
"Bob Hughes" <omniverse charter net> wrote:
> "Allen" <bri### [at] yahoocom> wrote in message
> news:web.496ecaad4b0681c28f162dfb0@news.povray.org...
> >I have an animation which the camera is moving through the scene.  However,
> > certain objects are to remain aligned to the camera as if the camera was
> > at <0,
> > 0, 0> with right in the +x direction and up in the +y direction and
> > looking
> > along +z.  How can I take an object(s) and transform them based on the
> > camera's
> > current position, angle, etc to achieve this?
>
>
> Not absolutely positive about this but maybe you could change
> splinefollow.pov example scene (scenes\animations subfolder) to be opposite.
> Camera as object and object as camera...?
>
> Bob

I had problems because I was generating part of the file from a script.  I
didn't think to incorporate the same changes applied to the camera to the
objects, but now I just use Spline_Trans on the objects as well as the camera.


Post a reply to this message

From: clipka
Subject: Re: How to align objects to camera.
Date: 15 Jan 2009 06:05:01
Message: <web.496f182d25793fecaf8dfc8f0@news.povray.org>
"Allen" <bri### [at] yahoocom> wrote:
> I have an animation which the camera is moving through the scene.  However,
> certain objects are to remain aligned to the camera as if the camera was at <0,
> 0, 0> with right in the +x direction and up in the +y direction and looking
> along +z.  How can I take an object(s) and transform them based on the camera's
> current position, angle, etc to achieve this?

Maybe the easiest way would be to not move the camera at all, but the scene...?


Post a reply to this message

From: Karl Anders
Subject: Re: How to align objects to camera.
Date: 16 Jan 2009 03:05:00
Message: <web.49703f7e25793fec843095f20@news.povray.org>
Hallo,

how about using screen.inc?
It's all there :-)

Happy tracing...

Karl


Post a reply to this message

From: John VanSickle
Subject: Re: How to align objects to camera.
Date: 26 Jan 2009 07:38:44
Message: <497daed4$1@news.povray.org>
Allen wrote:
> I have an animation which the camera is moving through the scene.  However,
> certain objects are to remain aligned to the camera as if the camera was at <0,
> 0, 0> with right in the +x direction and up in the +y direction and looking
> along +z.  How can I take an object(s) and transform them based on the camera's
> current position, angle, etc to achieve this?

That depends on how you place the camera.

In my animations, I make heavy use of titling and objects placed in 
front of the camera to produce fade effects.  For this I use the 
following variables:

pCamL= the location of the camera
pCamE = the look_at position of the camera
vCamS = the up direction for the scene (y for lefty worlds, z for righty 
worlds)
sCamZ = the zoom value

My main .POV file assigns default values to these, and then calls a 
scene file.  The scene file changes the values to whatever fits for the 
camera in the scene.  The main file then does the following:

#declare vCamD=vnormalize(pCamE-pCamL);
#declare vCamR=vnormalize(vcross(vCamS,vCamD));
#declare vCamU=vnormalize(vcross(vCamD,vCamR));

camera {
     right vCamR*image_width/image_height
     up vCamU
     direction vCamD*sCamZ
     locate pCamL
}

Then the main .POV file calls another .INC that builds the titling.  All 
titling is built so that it lies in or just beyond a rectangle that is 
centered at the origin and extends by half of the aspect ratio to the 
left, a similar amount to the right, and by .5 up and .5 down.

I then apply the following transforms to each titling object:

   translate z*sCamZ // (or y*sCamZ if you are modeling in a right-hand
                     // world)
   scale .1 // only needed if your titling intersects with the stuff
            // in your scene
   Matrix_Transform(vCamR,vCamU,vCamD,pCamL) // left-hand world
// or
   Matrix_Transform(vCamR,vCamD,vCamU,pCamL) // right-hand world

It is best to have titling that is very thin in the camera's direction, 
because if the zoom value changes, it will be apparent in the rendering 
of the titling objects.  However, don't make it too thin, or POV-Ray 
will not render some things (text, I have found) properly.

Your titling objects should be textured with ambient=1, diffuse=0, and 
do not cast shadows or are visible in reflections (unless you want this 
effect).

If you've understood all of this, your camera can be doing all sorts of 
wild gyrations, but the titling will remain solidly in place.

Hope this helps,
John


Post a reply to this message

From: clipka
Subject: Re: How to align objects to camera.
Date: 26 Jan 2009 11:30:01
Message: <web.497de49e25793fec16c2a5900@news.povray.org>
John VanSickle <evi### [at] hotmailcom> wrote:
> It is best to have titling that is very thin in the camera's direction,
> because if the zoom value changes, it will be apparent in the rendering
> of the titling objects.  However, don't make it too thin, or POV-Ray
> will not render some things (text, I have found) properly.

How about a plane, textured using the object pattern?


Post a reply to this message

From: John VanSickle
Subject: Re: How to align objects to camera.
Date: 26 Jan 2009 20:57:59
Message: <497e6a27$1@news.povray.org>
clipka wrote:
> John VanSickle <evi### [at] hotmailcom> wrote:
>> It is best to have titling that is very thin in the camera's direction,
>> because if the zoom value changes, it will be apparent in the rendering
>> of the titling objects.  However, don't make it too thin, or POV-Ray
>> will not render some things (text, I have found) properly.
> 
> How about a plane, textured using the object pattern?

That can work.

Regards,
John


Post a reply to this message

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