How to add random offset to sine time in Unity’s Shader Graph?


I have created a shader using Unity’s shaderGraph to move my clouds back and forth. I’m using Sine Time to alter the x-position of all the pixels in my sprite. Now, all the clouds are moving in sync, but I’d like to have them move a little more random.

In ShaderGraph, I’m trying to offset the sine wave by adding a random number to it, but it does not work the way I expect it to. Instead of having random movement, all the clouds change their starting position. I am probably going about it the wrong way. Any suggestions are more than welcome.

I have added my attempt in the table below.

What Screenshot from ShaderGraph
Change position using Sine Time.
All clouds moving in sync
default
Try to add offset with random range using the object’s x-position as seed.
All clouds moving in sync, but start position is changed
add random range

Here are the clouds floating in my game

floating skies



Source link

More To Explore

Share on facebook
Share on twitter
Share on linkedin
Share on email