I am making a slime-like material that uses World Position Offset and DistanceToNearestSurface to make meshes move towards near objects to act like slimes.
To make the material detect nearby objects I initially scale it so it makes a “detection zone” that I use to move the vertices to nearby objects if there are any.
the last multiply is plugged into WPO ^
Left = scale 25, 25, 0 / Right = scale 0, 0, 0
My problem is that the shadow that is being cast by the mesh is calculated using the detection zone instead of where the verticies actually are.
I made this material by following this tutorial and I saw that at 0:05 they actually managed to fix this issue but I’m not sure how since it isn’t what the video is about.
I’m thinking maybe by making the material be masked and using a shadow pass switch there might be a way to change the way the shadow is calculated and make it match where the vertices actually are but I can’t figure out the math behind it.