DistanceToNearestSurface material node disables shadows from masked materials.

To eliminate interferences I created a new empty project just with starter content.

I turned on Mesh Distance Fields in the Project Settings.

I created a masked material and used a starter content noise texture for the opacity mask and color.

I duplicated that material and as soon as i add the DistanceToNearestSurface material node to the opacity mask the shadows cast from objects with that material are gone.

You can tell from the surface that the opacity mask is working as intended but the shadows are gone.

What am I doing wrong?

Any help is appreciated!


Omg. I have similar trouble. But in another direction. I had FULL shading.

The reason for the issue is “DistanceToNearestSurface” node? I was told that there is a possibility that the rendering order, in this case, does not work correctly

But I can’t refuse it or replace it with some other node. Different variations of the “Lighting” settings of the object did not give a satisfactory result.

Maybe someone has encountered such a problem too and knows a possible solution?

@Shanyu, may you ping me please if developers or other experts will prompt a solution

Due to the nature of what Global Distance Field is, it is sort of expected.

You can use shadow pass separator material expression(or a custom node workaround explained here: link text)
to deal with it.

Thank you very much for the comment, it’s a very useful trick for future tasks. But it does not fix the issue

I begin to despair and think that solutions cannot be found and the use of distance disappears. although this is a very interesting shader feature