Download

How to get SceneDepth in Normal Direction?

I guess it’s actually the ‘Normal Direction * -1’, but I didn’t want to complicate title :slight_smile:

I have created a blob shadow and I am using this node setup, to get the offset between the geometry behind my material and the geometry, that my material is applied to. That Offset is used to determine the material’s opacity. The problem is, that my blob shadow mesh must not intersect with the ground, so it needs a little bit of a distance. So if the blob shadow is viewed at an angle, the difference between the SceneDepth and PixelDepth is greater than viewed from above. (See Pictures below. In the last Picture, where the shadow is viewed at an angle, the shadow is not visible.)

So is there a way to get the SceneDepth in normal direction, so that the viewing angle does not make a difference? (Maybe I could utilize SceneDepth’s UV input)

I guess otherwise I could try to minimize the artifacts as much as possible and it might be just good enough, but I would rather have a better solution.

Thank you for your help!

I believe I now have a good attempt at a solution, but I got stuck. I am currently calculating the angle between the camera vector and the vertex normal and I know the distance between my blob shadow mesh and the other geometry. I just can’t figure out, how to calculate the between my mesh and the other geometry at the given angle. Can someone help me out?

0654f70a31c80af33fe440f44dd5fdeed0e2fe24.png