Random UV offset flickering

I am using this simple shader to randomly offset UV of a texture:

The problem is that in game/scene view, the offset flickers randomly. like the result of the random range will change sometimes.

  • Tried using different seeds. same.
  • Tried using different seeds before combining, same.

What may have caused this?

9167714--1276022--flickering.gif

Update: Tried Unity 2022.3.5f1
Same results

What values are you using for a Seed input parameter?

1 to 7 and some float values. I was trying to implement your Hash23 from your YouTube and saw the flickering. I suspected the problem was for my implementation, so I tried to use a built-in random generation method and saw this.

If you provide us specific values, then everyone should be able to reproduce your case.
I tried to recreate your graph and by pure luck I was able get some flicker, but then I could not reproduce it no matter what and I don’t know what number was there.

The whole thing looks like some precision issue, but I fail to see why that would happen.
Also I observe your gif now and what is the condition to trigger this? It looks like it started flickering when you selected the object.

The gif is captured with 1 as seed value.

  • Scene-View: I suspect moving mouse cursor/ changing view direction in scene view/ selecting and deselecting objects will trigger the flickering. So maybe on repaint event or something? (Always refresh is on)
  • Game-View: When I enter play mode, it begins.

I copied the shader to my MacBook, and it did not happen there.
Host 1 - Windows 11 + NVIDIA GeForce RTX 3070 Laptop + 536.67 GeForce Driver version
Host 2 - MacBook Pro M2 Max

There is a weakness in the algorithm we’re using in the Random Range node. It’s similar to the one I introduced in my YouTube video. It’s using the sine function, and unfortunately, the sine function is implemented in different ways in different hardware. Some hardware implements it in a more robust way, and other hardware uses a faster approximation that can be slightly inaccurate. For some applications, these issues aren’t noticeable, but the one you’ve created here - basing your UV grid on the random value, makes the inaccuracy very obvious. We’ve fixed these issues recently in the Gradient Noise, Simple Noise, and Voronoi nodes with the addition of the Hash Type dropdown. The Deterministic option in that new dropdown uses our new noise algorithm which is much more robust. But the Random Range node is still using the older, weaker algorithm. I’ll put in a bug report to get the Random Range node updated. In the mean time, can you use the Simple Noise node to get the effect you’re trying to achieve?

Thank you for following up. Yes, I will try to achieve that with simple noise node.

So in short some hardware can produce different results for the same input for sine?

Hi @BenCloward ,
I’ve just created your Hash23 node in Shader Graph and I’m trying to use it to randomize UVs but I’m getting this flickering issue. How would you solve it for your Hash23 since it is using the sine function?