Change color based on distance from object
<p>I have two objects: let's call them object1 and object2. I can move object2 around, and I want to change the color of object2 based on its distance from object1. How can I do this in GLSL? I'm very new to this, but I think I'm supposed to pass a matrix from the vertex shader to a fragment shader, though I'm not sure which one.</p>