How to both crop and pan a texture in material

I have padded / atlas textures I would like to use in a billboard material I am making. I am trying to figure out a way to both isolate the correct part of the texture, and be able to do operations like panning and tiling on it without getting the rest of the texture in the image. Right now, I can get the cropping looking correct, but then when I offset it or pan it, I see the rest of the cropped part of the image.

I tried passing my UVs through to a custom UV channel but that didn’t seem to help.

I would greatly appreciate any guidance!

Frac, Floor and Ceil material expressions will help you. You can take a look at flibook material function and adapt what is in there for your needs.

I figured this out. The key piece of knowledge for me was that the panner does not output a value between 0 and 1 - it outputs a value that grows with time. Frac was the solution - I just take the decimal portion from the panner to give me a UV between 0 and 1, feed that into my cropping logic before passing those UVs along to the texture.

Good idea - this was a helpful suggestion.