I am trying to get the rain texture to pan slower when the vertex normal direction is facing upwards. Below you can see the shader network and a screenshot of the result.
It seems like the engine only chooses one normal direction and in those cases the result comes as expected. However when the normal direction is something else it fails and the panning gets really weird. The arrows in the picture describes in what UV direction the texture is panning. It should be worth mentioning that after a long time those "red"/failed areas gets really distorted/squeezed and after a certain amount of time you cannot even see the texture anymore.
If I clamp the values to min 0.0< ( example 0.8 ) max 1.0 more and more triangles get correct panning but ofcourse then I don't get the result I am after.
so yes.. It's kind of hard to explain but I hope I did ok.
If anyone has any idea of what's going on - please post : )
Replies
How do I set world-space?
so the first thing you'd need to do is find out what direction is "up" in UE4 (for example, is it Y up? i'll use that as the example i'm about to make).
then you'd need to find a way of describing what constitutes "up" in relation to the vertex normals. so i would do a dot product of the vertex normals, and a vec3(0,1,0). you would need to invert that though, as it would basically read as "1" or "full" whenever a face is directly up, and if i'm understanding you correctly you want it to be 0 or "none" when it's facing up.
Thank you! I was thinking of this earlier but I had no clue on how to solve it. This might work. I am going to try it out now.
And btw, Z is up in Unreal Engine.
You were thinking like this, right?
This is giving me the same result as earlier.
EDIT
I changed the vector3 to (0,0,-1) and inverted the VertexNormalWS node. Now I get a complete "flow" (no more weird directions) but the time seems to be the same all over the surface. The time is always muliplied by 1.
Also, it might be worth mentioning that in my first post where you see green arrows the effect actually worked. The panning was actually slower when the surface faced upwards.