Transparent mesh with depth renderer issue

Hello everyone!
Im trying to transfer this code

using postprocess.
Unfortunatelly it seems like I cant get proper depth value for the box while checking distance inside the box (shader code). Is there any way to get fully transparent box with proper depth value?


Looks like I found the difference, it was normalized rayDir vector. New playground