Use z-depth texture to blend rendered images/video correct

Is it possible to use a z-depth texture, exported from a 3D render together with beauty pass textures (with no background) to layer the textures correct.

Example: If we have exported images/video of two objects, that rotate around each other, and export the correlation z-depth textures (as images or video as well) and blend them correct, so they will be drawn correctly (So that the correct object is on top of the other)

Like this animation
https://3c1703fe8d.site.internapcdn.net/newman/gfx/news/2018/worldsfastes.gif

There is ColorAndDepth node, but also you need a 3d camera exported. Also depth in 3d software and depth in dx11 bit different between each other

1 Like

have a look at the textureFX nodes. this should help you. if you have two depth textures take the min or max of them and use the output as a mask in a texture mixer for your colors. (dx11 pack highly recommended)

color and depth.v4p (10.2 KB)

1 Like

Thanks @antokhio, for taking time to create the example. And thanks @tonfilm.

@antokhio, Maybe I did not explain myself clearly. What I am trying to do, is render two images of an 3D object, and export there z-depth maps as well, and then layer them correctly. I made some images that maybe can explain it better.

@tonfilm, that sounds correct, can you give some more in depth information? I am still learning the structure of VVVV

So the back and front torus, is two different renders, they could be video or images. They have a z-depth image, calculated in reference to the camera, but are in a global value range.

I know that the “composite_result” have shadows projected from the other object, and that is not possible with this technique, but it doesn’t matter for what I have to use it for.


Result I am trying to achieve in VVVV

Dude if you study example I gave ya closer, you will see that what is blended is two color textures and two depth textures, I know it may look not that obvious because of the camera in there but you can try putting your depth and color textures instead of render targets and disconnect a camera

2 Likes

@antokhio, I feel like an idiot, thank you so much :)

The depth map had to be inverted, to mask correct, but after that, it’s like the view in the z-axis is inverted. I tried to invert the cameras Z position, but it is not helping. Do you have a solution for this?

Not inverted

Inverted (Z-axis is inverted, for the masking, or something else?)

Complete patch (Your patch, edited, with textures)
z-depth_test.zip (566.6 KB)

This quite fun… tho no clue what to do… prolly formula has to be changed for that depth format, i’ll try to check, but no promises…

Also since you get it from 3d package that use raytracing and under the hood anti-aliasing, what you will get is all type of artifacts on the edges…

yeah i would strongly advice not to do this kind of stuff.
latest with video the depth artifacts will make it unusable.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.