I am currently trying to solve a certain technical art challenge I am facing. Not sure, if this is the correct place to ask since most of the posts seem very artsy and less tech art related. Are there other forums/discords you could recommend for people wanting to learn the tech art side of things regarding VFX?
Now, to my main question:
My goal is to create a shader (and script, if necessary) to fill any mesh with a gradient. The challenging part of it is that I want the gradient to always be level to the ground. In other words, the gradient should always be top to bottom while my mesh may rotate.
The first thing I tried was using world space or various approaches to triplanar projection, but I always end up with the same problem: I want the gradient to “scale” with the mesh. So, imagine having a gradient going from full white (1 - top) to full black (0 - bottom). Now, I want this gradient to fill my mesh from top to bottom. However, when I rotate my mesh, I want the gradient to adjust itself to the “new height” of the mesh so that it still goes from full white at the “new top vertex” to full black to the “new bottom vertex”.
Ideally my gradient would also scale up, if I scale up my mesh inside Unity, but it’s not a high priority. My main concern is that I want to be able to give a mesh a gradient that’s always level to the ground.
Any pointers would be really welcome!