POV-Ray : Newsgroups : povray.advanced-users : Obtaining Depth while using Anti-aliasing : Obtaining Depth while using Anti-aliasing Server Time
1 Jun 2024 01:36:45 EDT (-0400)
  Obtaining Depth while using Anti-aliasing  
From: handos
Date: 9 Jan 2013 15:30:01
Message: <web.50edd2ee984bc5d2d7ae32040@news.povray.org>
Hi everyone,

I had modified the source/backend/render/tracetask.cpp file to obtain the depth
map. Every instance of

From: trace(DBL(x), DBL(rect.top) - 1.0, GetViewData()->GetWidth(),
GetViewData()->GetHeight(), pixels(x, rect.top - 1)); was modified to my trace
function

To: trace(DBL(x), DBL(rect.top) - 1.0, GetViewData()->GetWidth(),
GetViewData()->GetHeight(), pixels(x, rect.top - 1),depthVal);

There are three places where this function is being used in this function
void TraceTask::NonAdaptiveSupersamplingM1()

(a) In the for loop where it says // sample line above current block

(b) The for loop just after that which starts from
   for(int y = rect.top; y <= rect.bottom; y++)
 trace(DBL(rect.left) - 1.0, y, GetViewData()->GetWidth(),
GetViewData()->GetHeight(), pixels(rect.left - 1, y),depthVal); // sample pixel
left of current line in block

(c) The immediate for loop over x has same trace

My modified trace function (defined in tracepixel.cpp in the same directory)
collects depth values and in the if (CreateCameraRay(ray, x, y, width, height,
rayno) == true)
it sums them all and then averages the depth like the colour value being
averaged.

I think there is something wrong going on in here because when I obtain two
rendered images with depth-maps and try to align the images based on the
depth-map I obtain something really peculiar.

I have the images shown here at this web-page:
http://www.doc.ic.ac.uk/~ahanda/anti_alias_depth.html

The first image (1,1) shows the registration of second image (called I_ref) with
the image at the bottom (called I_test). The black areas are marked as pixels
where the registration of I_ref with I_test (forward registraion) and
registraiton of I_test and I_ref (backwards registration) does not agree - this
could be pixels that are occluded etc. But I can't see why the plane at the
right is blacked! It shows that there is error in obtaining depth, isn't it? I
am wondering if someone will be able to help me fix the depth-map code in
tracetask.cpp / tracepixel.cpp files to make sure that I get expected results.

Apologies if this is something hard to understand for first time. I can
re-explain that!

Thank you,
Ankur.


Post a reply to this message

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