UE4. Change texture panning speed slowly. It is possible only in shader?

Greetings gentelmens :slight_smile:

Is that possible to slowly change texture panning speed without help of blueprints?
All solutions which came in mind first, like * or / operations on time value gives results where panning speed going crazy during that operations. But we want to change speed slowly, nice and easy :slight_smile:
Im starting to think what this is impossible without blueprints. Im wrong, no?

yeah, time multiplied by a constant will adjust speed. sine will make it oscillate.
I’m not sure if it occillates from -1 to 1 or from 0 to 1. so you may need a constant bias scale.

timecontrol

Every possible operations with time like multiplying or division will cause “burst texture movement” which are not allowed.

Well, dig deeper to that problem and it seems like its just impossible througth material editor only, cause we need to keep some current value, but we cant. And it also seems like even custom node and HLSL will not help it that case.

I’m not sure what you mean by burst tex movement. Based on how you described the speed going crazy you may mean it just pans really fast, which happens if you don’t frac the time value.

Example: we take Time/speed. Speed are scalar value which we change manually. Now we add result of that calculations to U or V and pan our texture.
Every time when we change speed value, texture panning will change really fast (like “burst”). We will not achieve slow speed increasing or decreasing during time when we change speed value.
After we stop changing speed value, out texture will back to normal panning speed (which can be pretty slow in fact).
You can try this time/speed or time*speed and see whats happen.

ah I guess I misunderstood you. I don’t think there is a way to interpolate to a value that is set by a bp from within the material.

It is not possible, no. If you need to dynamical and smoothly change the scrolling speed of a texture, the only solution is to do the panning via a blueprint, at least while you’re doing the rate adjustment. You can easily calculate the appropriate offset to add to match the material or blueprint controlled panning so the transition between the two doesn’t pop.

The trick is in your material have both a panning rate and a manual offset, uv = uv + frac(rate * time + offset). When you need to smoothly change the panning rate, use (current rate * (time - delta time) + offset) % 1.0 to get the current total offset, then set the rate to 0 and pan using only the offset value with offset = (offset + delta time * rate) % 1.0. When you want to go back to letting the material do the panning, set the materials rate again, and set the material’s offset to (rate * time) % 1.0 - offset.

As an alternative, couldn’t you set up a dynamic parameter in the particle editor and create a curve?

1 Like

Hm, maybe, but idea was to create it only with shader, without any side help of bp or particle system.
Anyway it was just some concept which i was wanted to prove, but probably there’s a lot of other more easiest solutions.

If this is for a particle you can always expose a parameter that would add to the current time. It can be a little bit finicky, especially if you have a large difference in life-times.

I can’t remember if this works or not. I know there’s some things that don’t play well with curve/life. You can use a uniform range with particle lifetime, but not sure how well it works with points on a curve

Yes, it is possible. You could use sine or any other math function to make non linear panning.
Check out this GDC talk to get some tips on math functions:

You could maybe use non linear math in the mask of a lerp node, learping between a normal UV Cordinate and a panner.

1 Like