POV-Ray : Newsgroups : povray.advanced-users : Depth output from POVray Server Time
30 Jul 2024 16:18:19 EDT (-0400)
  Depth output from POVray (Message 4 to 13 of 23)  
<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: ingo
Subject: Re: Depth output from POVray
Date: 21 Sep 1999 12:33:30
Message: <37e7b35a@news.povray.org>
Ron Parker <par### [at] fwicom> schreef in berichtnieuws
slr### [at] rongwmicrocom...
> On 21 Sep 1999 09:14:44 -0400, Nieminen Juha wrote:
> >  This is a VFAQ. Anyone willing to write a comprehensive answer to
this so
> >that I can put it on the page?
>
> Someone wrote a whole chapter about this in a Waite Group book on
making
> SIRDS ....

What is / are SIRDS ?

Ingo


Post a reply to this message

From: Ron Parker
Subject: Re: Depth output from POVray
Date: 21 Sep 1999 12:40:18
Message: <37e7b4f2@news.povray.org>
On Tue, 21 Sep 1999 18:33:36 +0200, ingo wrote:
>Ron Parker <par### [at] fwicom> schreef in berichtnieuws
>slr### [at] rongwmicrocom...
>> On 21 Sep 1999 09:14:44 -0400, Nieminen Juha wrote:
>> >  This is a VFAQ. Anyone willing to write a comprehensive answer to
>this so
>> >that I can put it on the page?
>>
>> Someone wrote a whole chapter about this in a Waite Group book on
>making
>> SIRDS ....
>
>What is / are SIRDS ?

Single Image Random Dot Stereograms.  Often known by the trademarked
name "Magic Eye."


Post a reply to this message

From: Peter Popov
Subject: Re: Depth output from POVray
Date: 21 Sep 1999 18:46:48
Message: <WgroNzmOZ7X2FDK=ETYWw3peFcbG@4ax.com>
On Tue, 21 Sep 1999 15:09:19 +0200, "Simen Kvaal"
<sim### [at] studentmatnatuiono> wrote:

>Hi there.
>
>Is there any way to make POV-ray output the depth to a file, instead of the
>actual renders? That is, can POV output a Z-buffer sort of thing for import
>in other programs?
>
>Simen.

A quick and dirty way is to place the whole scene in a union, give it
a white pigment, an ambient of 1 and diffuse 0, and use black fog to
dim the distant objects. Works quite well for me.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Bob Hughes
Subject: Re: Depth output from POVray
Date: 21 Sep 1999 21:17:05
Message: <37e82e11@news.povray.org>
Think I'd use a gradient z pigment instead.  I have one RDS (random
dot stereogram, not RayDreamStudio) program here that accepts the
depth info in Bmp images which I suppose might be simple color
shifting, not sure.  I need to dust it off and give it a try.

Bob

Peter Popov <pet### [at] usanet> wrote in message
news:WgroNzmOZ7X2FDK=ETYWw3peFcbG@4ax.com...
> On Tue, 21 Sep 1999 15:09:19 +0200, "Simen Kvaal"
> <sim### [at] studentmatnatuiono> wrote:
>
> >Hi there.
> >
> >Is there any way to make POV-ray output the depth to a file,
instead of the
> >actual renders? That is, can POV output a Z-buffer sort of thing
for import
> >in other programs?
> >
> >Simen.
>
> A quick and dirty way is to place the whole scene in a union, give
it
> a white pigment, an ambient of 1 and diffuse 0, and use black fog to
> dim the distant objects. Works quite well for me.
>
>
> Peter Popov
> ICQ: 15002700


Post a reply to this message

From: TonyB
Subject: Re: Depth output from POVray
Date: 21 Sep 1999 21:29:59
Message: <37e83117@news.povray.org>
>A quick and dirty way is to place the whole scene in a union, give it
>a white pigment, an ambient of 1 and diffuse 0, and use black fog to
>dim the distant objects. Works quite well for me.


And what do you use it for? How would using this improve my scenes?


Post a reply to this message

From: Peter Popov
Subject: Re: Depth output from POVray
Date: 22 Sep 1999 04:25:50
Message: <7ZHoN30Y7JoT=URFG+w9p7XL5DM6@4ax.com>
On Tue, 21 Sep 1999 20:24:27 -0400, "TonyB"
<ben### [at] panamaphoenixnet> wrote:

>>A quick and dirty way is to place the whole scene in a union, give it
>>a white pigment, an ambient of 1 and diffuse 0, and use black fog to
>>dim the distant objects. Works quite well for me.
>
>
>And what do you use it for? How would using this improve my scenes?
>
You can use it as a selection in PSP, for example, apply gaussian blur
and have a cheap focal blur. Faster and smoother than POV's, though
not as accurate. Or you could desaturate the image with distance to
get a Rennaissance painting look. Such things.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Peter Popov
Subject: Re: Depth output from POVray
Date: 22 Sep 1999 04:27:41
Message: <V5LoN5TatESKTQfzmmjrCp0Po8Ya@4ax.com>
On Tue, 21 Sep 1999 20:16:01 -0500, "Bob Hughes" <inv### [at] aolcom>
wrote:

>Think I'd use a gradient z pigment instead.  I have one RDS (random
>dot stereogram, not RayDreamStudio) program here that accepts the
>depth info in Bmp images which I suppose might be simple color
>shifting, not sure.  I need to dust it off and give it a try.
>
>Bob

A linear gradient will give a very inaccurate result in points not
directly in front of the camera. I sometimes use a spherical pigment.
The problem is that it's hard to get its scale right, especially if
you have a ground plane, but for indoor or single object scenes it is
the best choice.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Simen Kvaal
Subject: Re: Depth output from POVray
Date: 22 Sep 1999 06:55:13
Message: <37e8b591@news.povray.org>
I am replying to my own post, now, because I've developed a way to do what I
wanted. I hope this could be of use to anyone who needs a depth-buffer from
a pov-ray scene.

I looked at an old pov-zine, and there it was mentioned that if I removed
all texures from the object and applied a deafult texture with gradient
which varies from white (near) to black (far) in the direction of the
looking vector of the camera, then I'd essentially get the depth information
in the rendering. Near points would be white and black points would be the
ones far away.

Some of you asked why someone would want tihis? One answer, (not mine), is
to use then in a SIRDS-program, which requires depth information from the
scene in order to generate the illusion of depth. This method works fine for
that purpose.

However, I wanted a real Z-buffer output. I am testing a shading program I
have written and want to use some objects that I really know what looks
like. I have generated several million random points that form a shape in
three dimensions. POV cannot easily handle  that many spheres, so I've
written a program that makes a Z-buffer and shades the scene from that. In
order to test the performance, I needed som Z-buffers of "real" world
things, like cubes, spheres, torii et.c. Then it would be easy too se how
realistic the shading of the z-buffer was. (It's hard to see with some
smoke-resembling cluod of dots.)

To the point. Here is a scene I wrote this morning (local time):


// beginning of code:

#declare cam_pos = <0,0, -5>
#declare cam_rot = <20, 0, 0>
#declare max_depth = 10;
#declare min_depth = 1;


default {
        texture {
                pigment {
                        onion
                        color_map {
                                [0.0 color rgb 1]
                                [1.0 color rgb 0]
                        }
                        phase min_depth/(max_depth-min_depth)
                        scale (max_depth-min_depth)
                }
                finish { ambient 1 diffuse 0 }
                translate cam_pos
                rotate cam_rot

        }
}
camera {
        location cam_pos
        direction z
        up y
        right 4/3*x
        look_at 0
        rotate cam_rot
}

box {-1, 1 rotate <50, 40>}

// end of code.


This scene is a general case. I can change the camera position in cam_pos
and rotation in cam_rot and still generate a z-buffer output. If I used a
simple gradient texture, I would have errors. Mainly because of perspective
distortion. Points on the edge of the image which have color w, say 0.8,
would actually be farther away than a point with color w in the middle of
the image. The solution was to use the onion procedural texture, which is
cocentric spheres centered at the origin. For the depth-view purposes, the
texture is translated to the camera location, so that the centre of the
spheres is located at the view-point. Then, it is rotated, if the camera is
rotated to a new place.

By using this method, one can easily verify that a point (x,y,z) with
distance d from the eye, would get the same color as any other point (x1,
y1, z1) with distance d from the eye.

The next problem is scaling of the texture. The texture has originally a
range of 1, that is it wraps from black to white every 1 units from the
centre of the texture, that is the eye in this case. We want to scale it so
that the nearest *visible* point gets a shade close to white, while the
farthest visible point gets a shade closer to black. There must be no
wrapping, or else we would get wrong depth-information.

The solution is quite easy, you scale and offset the wrapping of the texture
with
            phase min_depth/(max_depth-min_depth)
            scale (max_depth-min_depth)

where max_depth is an estimate of the distance to the farthest point we want
to shade, and min_depth is the distance to the nearest.

The output from this source is an approximate depth-buffer from the scene,
which then can be used as wished.

Simen.


Post a reply to this message

From: Ron Parker
Subject: Re: Depth output from POVray
Date: 22 Sep 1999 09:15:26
Message: <37e8d66e@news.povray.org>
On Wed, 22 Sep 1999 11:26:54 +0300, Peter Popov wrote:
>On Tue, 21 Sep 1999 20:16:01 -0500, "Bob Hughes" <inv### [at] aolcom>
>wrote:
>
>>Think I'd use a gradient z pigment instead.  I have one RDS (random
>>dot stereogram, not RayDreamStudio) program here that accepts the
>>depth info in Bmp images which I suppose might be simple color
>>shifting, not sure.  I need to dust it off and give it a try.
>>
>>Bob
>
>A linear gradient will give a very inaccurate result in points not
>directly in front of the camera. I sometimes use a spherical pigment.
>The problem is that it's hard to get its scale right, especially if
>you have a ground plane, but for indoor or single object scenes it is
>the best choice.

When I wrote my patch I originally wrote it to take the length of 
the eye ray (analogous to a spherical gradient) but it seemed to
warp the resulting scene.  When I switched to a linear gradient 
(length of eye ray dotted with camera direction vector) it flattened
out.

Another thing that can help, if your SIRDS program supports it (I
have one that does) is to use hf_gray_16.


Post a reply to this message

From: Bob Hughes
Subject: Re: Depth output from POVray
Date: 22 Sep 1999 17:33:08
Message: <37e94b14@news.povray.org>
Interesting to know. Thanks guys.

Bob

Ron Parker <par### [at] fwicom> wrote in message
news:37e8d66e@news.povray.org...
> On Wed, 22 Sep 1999 11:26:54 +0300, Peter Popov wrote:
> >On Tue, 21 Sep 1999 20:16:01 -0500, "Bob Hughes" <inv### [at] aolcom>
> >wrote:
> >
> >>Think I'd use a gradient z pigment instead.  I have one RDS
(random
> >>dot stereogram, not RayDreamStudio) program here that accepts the
> >>depth info in Bmp images which I suppose might be simple color
> >>shifting, not sure.  I need to dust it off and give it a try.
> >>
> >>Bob
> >
> >A linear gradient will give a very inaccurate result in points not
> >directly in front of the camera. I sometimes use a spherical
pigment.
> >The problem is that it's hard to get its scale right, especially if
> >you have a ground plane, but for indoor or single object scenes it
is
> >the best choice.
>
> When I wrote my patch I originally wrote it to take the length of
> the eye ray (analogous to a spherical gradient) but it seemed to
> warp the resulting scene.  When I switched to a linear gradient
> (length of eye ray dotted with camera direction vector) it flattened
> out.
>
> Another thing that can help, if your SIRDS program supports it (I
> have one that does) is to use hf_gray_16.


Post a reply to this message

<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>

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