Hello, I’m a newbie and I have a question. The time port of the time node in shader graph is an increasing value which represents the game time. Therefore, if I multiply it with a vector 2, the vector 2 should become an increasing value too as I understand(Like s=vt). Whereas the vector 2 didn’t change. (As you can see in the picture below, I connected it with the offset port. So the scrolling speed of the texture should be increasing, which means it should accelerate.) For instance, I think that should work like this: When game time = 3 = Time.time, the vector 2 = (1, 1), the result of the calculation should be (3,3). A pro gave me this answer but I’m still confused:
think of time as distance when a car drives in your case, and the change of time as speed the car has
the speed is constant, 1 per second (well it’s literally time)
but the distance increases
so the change in Time.time is constant (assuming a time scale of 1)
but the value for time.time itself gets bigger
if you run this equation every second
carPosition = startPosition + velocity * time;
if you look at the car, you can see that the car travels at linear speed, with acceleration or deceleration
if the velocity does not change
in your case the velocity is vector2(2, 0)
it is constant, the time increases over time, but as the velocity is constant, your object also travels at constant speed
Can anyone give me another answer or explain his? Please be understandable and simple cause I’m really bad. I sincerely appreciate if someone could help. Thank you.
Time.time returns the time at the beginning of this frame in seconds since the start of the application. For simplicity, let's say for frame 1, Time.time = 1s
Now if we multiply it by a Vector2, it will multiply each vector value for the Time.Time value.
Looking at your graph, we'll assume a value of Vector2 (2 ,0)
So for frame 1 the output will be Vector2(2 x 1s, 0 x 1s) = Vector2(2, 0)
Next frame Time.time will update and increase by the amount of time in seconds that elapsed since the last frame completed. We'll say it took 2s to complete.
Now Time.time = 1s (that already passed until last frame) + 2s (that took to complete last frame) = 3s
So for frame 2 the output will be Vector2(2x3 , 0x3) = Vector2(6, 0)
Next frame takes another 2 seconds, so Time.time = 3s + 2s = 5s so for frame 3, it'll be Vector2(2x5, 0x5) = Vector2(10, 0) and so on.
When you apply this output value to the offset of a texture the same way you did in your shaderGraph, the result will be a scrolling effect that will move only in horizontal due to the Y value in Vector2 being always = 0
PS: Bear in mind that the real value for Time.time will be a number with many decimals like *0,3533334* and Time.deltaTime (the time that took unity to complete last frame) can be something such as *0,01737814* for one frame and something completely different for the next like *0,3333333* depending on the complexity of the calculations required for last frame.