Distance blending between two gameobjects?

Darkness Seeker 9 months ago 0

Recently I have began to use Shader Forge and search for interesting examples and ideas to learn, and I found this example about Distance Blending in the Shader Forge Wiki. I've been testing it and it works perfectly, but a little doubt has come to my mind:  

 How exactly would I be able to create the same effect by using the distance between two different game objects (let's say a cube with the shader a sphere that gets closer for simplicity) instead of using the View position? I know that there are transform and object position nodes, but they seem to work with the gameobject where the shader is placed in, without any option to "link" and external gameobject as if it was a C# variable.

Any ideas?