Page 1 of 1
Depth Pass needs white background
Posted: Thu Mar 12, 2015 5:45 pm
by profbetis
The black background in the Depth Pass is very wrong, as that puts "infinity" at a distance of zero. This messes with a lot of depth-based effects and is very hard to work with. A current workaround is to make a large hollow sphere around your environment, but this complicates things and is unnecessary.
Re: Depth Pass needs white background
Posted: Thu Mar 12, 2015 7:22 pm
by stratified
profbetis wrote:The black background in the Depth Pass is very wrong, as that puts "infinity" at a distance of zero. This messes with a lot of depth-based effects and is very hard to work with. A current workaround is to make a large hollow sphere around your environment, but this complicates things and is unnecessary.
The easiest is to use depth + alpha in your effects. Alpha is 0 where depth is infinity.
cheers,
Thomas
Re: Depth Pass needs white background
Posted: Thu Mar 12, 2015 10:05 pm
by profbetis
So programming an incorrect depth pass is the right solution here?
In what instance is having black at infinity ever useful? You should use the alpha matte as you're suggesting to make infinity black.
Re: Depth Pass needs white background
Posted: Fri Mar 13, 2015 1:03 am
by stratified
Hi,
Just a clarification for interested readers. The Z-depth is a real depth value in
[0, +infinity). The pixels are white because they are clamped to 1.
I did a quick experiment of writing a large value for those pixels where the ray leaves the scene. Now you get these horrible edge artefacts because of the anti-aliasing filter. I don't think that is any better so we'll leave it as is. I don't think using the alpha channel is a too bad.

- Edge artifacts - 5000 samples/px
cheers,
Thomas
Re: Depth Pass needs white background
Posted: Fri Mar 13, 2015 5:57 am
by profbetis
In the parameters there is a 'Z-depth Max'. Maybe setting the escaping rays to this value would be reasonable? I think I understand what you're getting at, it's just a very 'unnatural' map that's messy. Far values should look like other far values, not close values. In fact maybe any escaping rays don't output their actual distance, and instead just return an RGB value of (255,255,255)
(On a side note, can we maybe move this thread to General Discussion?)