[SOLVED] Custom shader: UV scrolling

Hi

I’m trying to simply scroll UVs in a custom shader.
Here’s my test project:
https://playcanvas.com/editor/scene/774535

In the vertex shader, I’m passing in time and assuming I could do this to scroll horisontally:

vUv0 = uv_tex + vec2(timer, 0);

But for some reason, it’s not working. The result is a blurred texture (in this case gray because I’m testing on a checkered texture). How can I make it scroll?

Wow, I feel really stupid on this one. Apparently, this.time was NaN. I didn’t initialize the number, assuming it would be inferred that dt should be treated as a number. I guess not. Coming from a C# background, I’m really getting slapped by javascript from time to time :blush:

2 Likes