Shader Flip at 180 Degrees

Hello! I’m looking to create a shader and fix the issue of the texture ‘flipping’ when the rotation of the Sun Light reaches above 180 (or below 0 as well). Currently we have a constant input for time, and the atmosphere sun light vector put in for speed (as mentioned by this post .)

Our logic works for what we want, but how do we solve the issue of the flipping? Do we need two separate textures (with the second flipped, to be used between 180-360 degrees)? We’re hoping for code to fix it as that is easily replicable. We’re just using fill in shaders for the moment, I’ve included the one used in the screenshot.

If it changes anything else, we’re using 5.4. Thanks for any input!


It is hard to tell. Parameter “atmosphere sun light vector” is it scalar or vector value?
My first guess is that at some point it gets to negative and flips UVs.

btw.
there are DEBUG nodes now for materials, use one of those to see what is going on.

And you can print that param directly in blueprints to see its value when shader flips.

Ps. you can try to flip how you feed UV node:

  • connect 1.0 node to speed
  • and your parameter to time.