0
$\begingroup$

Lets assume, we have two depth maps with us and their corresponding color maps. Now, our task is to populate a final image that will be displayed.

Each pixel in the final image needs to be calculated from the given 4 maps - two color and corresponding depth. I am simply aiming to create a final image considering the occlusion of one depth map over the other.

My idea is to just compare the depth values and then take the color value from the map whichever is closer to the camera.

Is this a right way to approach the problem?

PS: This problem popped up as part of a hybrid rendering solution am working on - combining ray marching and rasterization to get triangles as well as metaballs working. So, one of the pair of maps above comes from rasterization and the other comes from ray marching.

$\endgroup$
2
  • $\begingroup$ BTW this is basically how your depth buffer works in your graphics card. It's basically right, but you may want to also consider adding sub-pixel interpolation/filtering/sampling. So that a diagonal line of near-white pixels over a far-black background can produce gray pixels to "antialias". $\endgroup$
    – Wyck
    Apr 6 at 14:39
  • $\begingroup$ Interesting. I will try to integrate that. $\endgroup$ Apr 7 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.