make texture always face direction? ie aim arrow at world up

hey guys, having trouble doing the title or finding resources on it even though I imagine plenty have done it before.
I would like to do some shader effects like rain drops but need to orient textures to face upwards. the closest Ive gotten is with a position node set to absolute world, but as you can see its clearly not the way to do it
9248808--1293054--upload_2023-8-24_21-46-59.png
if you need another example, you can imagine applying this gradient texture to a rolling sphere, and no matter the sphere angle the gradient is always facing up like this

Does anyone know how to do this? would really appreciate the help!

To project a texture from the top, you can use the X and Z components of the Position as the coordinates. The most basic version of that would look like this:

This will look correct when the surface is facing up, but will have stretching artifacts on the sides of objects. To fix that, you can use the mesh’s normal as a mask. Let me know if you want to see an example of that. Is this what you’re looking for?

1 Like

sorry for the delay, Ive switched off working with shaders for the moment since I had gotten what I was looking for, but I am still interested in this topic

I needed to do this for a rain effect and since rain only streaks on the sides I was able to get that to work with this 9287767--1301728--upload_2023-9-11_20-17-10.png
a time node is going into that multiply node btw, it scrolls it down. while this got what I needed since the top and bottom look different than the sides, I would still like to know how you would orient a texture perfectly up something as I had originally described, ie arrows pointing up a sphere and reaching up to the apex of the sphere. getting the scroll effect on the triplanar to scroll down on each of those split channels, in the same intended direction at once was something I also couldnt get to work. definitely felt like something with my approach was wrong.
I would love to see an example of what you mean by using the mesh’s normal as a mask, if you dont mind, again sorry for the delay