POV-Ray : Newsgroups : povray.general : Always on top Server Time
29 Nov 2024 21:40:11 EST (-0500)
  Always on top (Message 1 to 7 of 7)  
From: kerosin
Subject: Always on top
Date: 24 Apr 2005 19:00:00
Message: <web.426c24828463c03fc4fdd5a30@news.povray.org>
Hi,

is there a way to tell povray to keep an object "always on top" like it is
possible in OpenGL? This means the object is placed at the given position
but will not be masked by any other object. I know I could make my other
objects transparent, but thats not an option for my case. I could also try
to move the "always on front" object further towards the camera, but since
i generally have a lot of objects and my files are generated automaticaly
thats also not really an option.

Could someone please help me with this.

Thank you a lot

Andreas Moll


Post a reply to this message

From: Slime
Subject: Re: Always on top
Date: 24 Apr 2005 19:10:43
Message: <426c2773$1@news.povray.org>
> is there a way to tell povray to keep an object "always on top" like it is
> possible in OpenGL?

Not really, since POV-Ray doesn't work with a depth buffer like OpenGL
does... if an object is behind another one, it will be shown that way.

One possibility, if the given object is simple, is to create an object which
is the projection of the object in question from the camera's position, and
then difference that from everything else, cutting a hole all the way to the
object. But that's pretty difficult.

> I could also try
> to move the "always on front" object further towards the camera, but since
> i generally have a lot of objects and my files are generated automaticaly
> thats also not really an option.

This, however, probably is your best option, (unless you need the objects to
respond to lighting as though they hadn't been moved), and it should be
doable:

Take the objects that need to be in front of the camera, and put them in a
union{}. Translate this union by the opposite of the camera position (for
instance, if the camera is at <-2,3,4>, translate the union by <2,-3,-4>).
Then scale it very small (scale .001 or something like that), and then
translate it back (translate <-2,3,4>). This will pull the objects closer to
the camera.

Another option is to determine where the objects should appear on the
screen, and then place them there with screen.inc.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Warp
Subject: Re: Always on top
Date: 25 Apr 2005 05:46:48
Message: <426cbc88@news.povray.org>
Slime <fak### [at] emailaddress> wrote:
> > is there a way to tell povray to keep an object "always on top" like it is
> > possible in OpenGL?

> Not really, since POV-Ray doesn't work with a depth buffer like OpenGL
> does... if an object is behind another one, it will be shown that way.

  In theory it wouldn't be impossible to patch POV-Ray so that it would
support this kind of feature.
  When shooting a ray, POV-Ray would first test against this object and
if the ray hits it then it ignores everything else, if it doesn't then
it just raytraces in the regular way.
  The opposite would also be possible: If the ray does not hit anything
then (and only then) it is tested against the object. This would make
the object to appear behind everything else (it would thus work like
sky_sphere, but with any object).

  Of course lighting and shadowing of these objects would often be
unnatural, but then, the user should know what he is doing anyways...

-- 
                                                          - Warp


Post a reply to this message

From: Ger
Subject: Re: Always on top
Date: 25 Apr 2005 06:27:33
Message: <426cc615@news.povray.org>
Slime wrote:

>> is there a way to tell povray to keep an object "always on top" like it
>> is possible in OpenGL?
> 
> Not really, since POV-Ray doesn't work with a depth buffer like OpenGL
> does... if an object is behind another one, it will be shown that way.
> 
> One possibility, if the given object is simple, is to create an object
> which is the projection of the object in question from the camera's
> position, and then difference that from everything else, cutting a hole
> all the way to the object. But that's pretty difficult.
> 
>> I could also try
>> to move the "always on front" object further towards the camera, but
>> since i generally have a lot of objects and my files are generated
>> automaticaly thats also not really an option.
> 
> This, however, probably is your best option, (unless you need the objects
> to respond to lighting as though they hadn't been moved), and it should be
> doable:
> 
> Take the objects that need to be in front of the camera, and put them in a
> union{}. Translate this union by the opposite of the camera position (for
> instance, if the camera is at <-2,3,4>, translate the union by <2,-3,-4>).
> Then scale it very small (scale .001 or something like that), and then
> translate it back (translate <-2,3,4>). This will pull the objects closer
> to the camera.
> 
> Another option is to determine where the objects should appear on the
> screen, and then place them there with screen.inc.
> 
>  - Slime
>  [ http://www.slimeland.com/ ]

Actually, there is a very simple, although laborious, way of doing a thing
like this.

First render your scene without the object you want to be "allways on top"
Second render the "allways on top" object with all the lighting from the
first render. If you make the second render with alpha channel on you can
then overlay the second render on the first one. This also works when
creating animations.
In the second render you can not use things like fog because this will
obscure the first render fully.

-- 
Ger


Post a reply to this message

From: Shay
Subject: Re: Always on top
Date: 26 Apr 2005 08:10:22
Message: <426e2fae$1@news.povray.org>
kerosin wrote:

There is a way to get this effect, provided you're not trying to "look 
through" any media or objects very close to the camera.

Put your "always on top" object in its own light group. Move the object 
and its lights very close to the camera after scaling them so that the 
object appears to be at the same distance as its original position.

  -Shay


Post a reply to this message

From: Warp
Subject: Re: Always on top
Date: 26 Apr 2005 10:46:11
Message: <426e5433@news.povray.org>
Shay <s.s@s> wrote:
> Put your "always on top" object in its own light group. Move the object 
> and its lights very close to the camera after scaling them so that the 
> object appears to be at the same distance as its original position.

  This can be easily done like this:

object
{ TheObject
  translate -CameraLocation
  scale 1/100
  translate CameraLocation
}

-- 
                                                          - Warp


Post a reply to this message

From: ABX
Subject: Re: Always on top
Date: 26 Apr 2005 11:42:00
Message: <q1os61dls5db9cr30ig0pfs7i5an38uol5@4ax.com>
On 26 Apr 2005 10:46:11 -0400, Warp <war### [at] tagpovrayorg> wrote:
> Shay <s.s@s> wrote:
> > Put your "always on top" object in its own light group. Move the object 
> > and its lights very close to the camera after scaling them so that the 
> > object appears to be at the same distance as its original position.
>
> This can be easily done like this:
>
> object
> { TheObject
>   translate -CameraLocation
>   scale 1/100
>   translate CameraLocation
> }

Not fully ontopic but this "classic" trick is not specific to 3D CG world
http://www.martinliebscher.de/ufo.htm

ABX


Post a reply to this message

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