POV-Ray : Newsgroups : povray.advanced-users : POVRay Depth-map Server Time
31 Oct 2024 21:22:34 EDT (-0400)
  POVRay Depth-map (Message 1 to 3 of 3)  
From: handos
Subject: POVRay Depth-map
Date: 21 Sep 2012 13:15:01
Message: <web.505c9f9f85132defd7ae32040@news.povray.org>
Hi everyone,

I had written a povray patch for obtaining depth per pixel of an image some time
ago. I had used povray-3.7 and modified the tracetask.cpp in
(source/backend/render/tracetask.cpp) in the function TraceTask::Run() where I
was using all the time SimpleSamplingM0() and in this function I replaced the
line
 trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col);
by
 trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col,
depthVal); to obtain the depth. I have been using Jaime's office scene for
rendering and obtaining depth-map but I only observe that there are
discretization artifacts I observe in the depth. I have kept the image and the
depth file here at www.doc.ic.ac.uk/~ahanda/scene_and_depth.html . I am
wondering if this is due to very simple sampling method used for tracing? I am
not using any AntiAliasing options and jitter etc. to render that scene and
simply picking up the depth values returned by the trace function that's called
by SimpleSampleM0().


Thank you,


Post a reply to this message

From: clipka
Subject: Re: POVRay Depth-map
Date: 21 Sep 2012 17:38:02
Message: <505cde3a$1@news.povray.org>
Am 21.09.2012 19:10, schrieb handos:
> Hi everyone,
>
> I had written a povray patch for obtaining depth per pixel of an image some time
> ago. I had used povray-3.7 and modified the tracetask.cpp in
> (source/backend/render/tracetask.cpp) in the function TraceTask::Run() where I
> was using all the time SimpleSamplingM0() and in this function I replaced the
> line
>   trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col);
> by
>   trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col,
> depthVal); to obtain the depth.

That change alone wouldn't do much good, because it wouldn't compile; 
you must have changed other stuff besides, at least the function 
operator in TracePixel:
   void operator()(DBL x, DBL y, DBL width, DBL height, Colour& colour)

> I have been using Jaime's office scene for
> rendering and obtaining depth-map but I only observe that there are
> discretization artifacts I observe in the depth. I have kept the image and the
> depth file here at www.doc.ic.ac.uk/~ahanda/scene_and_depth.html . I am
> wondering if this is due to very simple sampling method used for tracing? I am
> not using any AntiAliasing options and jitter etc. to render that scene and
> simply picking up the depth values returned by the trace function that's called
> by SimpleSampleM0().

This is interesting: It isn't just some color banding - each band is a 
gradient of its own. I'm pretty sure you're doing something wrong there.

You're obviously translating the depth value into a color; are you sure 
that algorithm works properly? An error in some code intended to 
interpolate between colors from a table might fit the bill.


Post a reply to this message

From: handos
Subject: Re: POVRay Depth-map
Date: 22 Sep 2012 04:45:01
Message: <web.505d7a3363488453d7ae32040@news.povray.org>
Hi Clipka,

I had changed void operator()(DBL x, DBL y, DBL width, DBL height, Colour&
colour)
this function.

Yes, you are right! There was something wrong with the way I was displaying it.
Because the displaying algorithm had only limited grey value resolution, it
quantized everything and created bands of depth. How just such a simple thing
confounded me.

Thanks for your message,
Ankur.

clipka <ano### [at] anonymousorg> wrote:
> Am 21.09.2012 19:10, schrieb handos:
> > Hi everyone,
> >
> > I had written a povray patch for obtaining depth per pixel of an image some time
> > ago. I had used povray-3.7 and modified the tracetask.cpp in
> > (source/backend/render/tracetask.cpp) in the function TraceTask::Run() where I
> > was using all the time SimpleSamplingM0() and in this function I replaced the
> > line
> >   trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col);
> > by
> >   trace(x, y, GetViewData()->GetWidth(), GetViewData()->GetHeight(), col,
> > depthVal); to obtain the depth.
>
> That change alone wouldn't do much good, because it wouldn't compile;
> you must have changed other stuff besides, at least the function
> operator in TracePixel:
>    void operator()(DBL x, DBL y, DBL width, DBL height, Colour& colour)
>
> > I have been using Jaime's office scene for
> > rendering and obtaining depth-map but I only observe that there are
> > discretization artifacts I observe in the depth. I have kept the image and the
> > depth file here at www.doc.ic.ac.uk/~ahanda/scene_and_depth.html . I am
> > wondering if this is due to very simple sampling method used for tracing? I am
> > not using any AntiAliasing options and jitter etc. to render that scene and
> > simply picking up the depth values returned by the trace function that's called
> > by SimpleSampleM0().
>
> This is interesting: It isn't just some color banding - each band is a
> gradient of its own. I'm pretty sure you're doing something wrong there.
>
> You're obviously translating the depth value into a color; are you sure
> that algorithm works properly? An error in some code intended to
> interpolate between colors from a table might fit the bill.


Post a reply to this message

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