So, a quick story first:
Some month ago I found myself working on some fx/materials that needed “LedScreen” like behaviour.
Now that I’m writing it I find out how little descriptive that is…
In other words, I needed to pan a texture with a shape through a grid like mask, each cell needed to have a specific shape.
Why not using a mask?
It needed to behave somewhat as a pixel besides how much space it takes, so that it reads only one of the texels values of the texture behind and display its value.(if that make any sense whatsoever)
Here are some gifs of the resulted shader behaviour so that you can see what I mean:
Artstation post in case you´re curious: https://www.artstation.com/artwork/2xo90J
In that time the only Idea I came up with, to make it fast enough so that I get it done in time and have control of the pixel behaviour, was to “bake” custom UV so that for each cell it would read only the center texel of the texture.
So here is the final look of that texture:
I used the Red and Green channels to pack the Uv, the Blue channel contains the shape that will pann over the pixels. The Alpha channel to multiply everything.
This was a good solution for my problem, gave me freedom to customize my “Screen” however I waned.
But it had many cons too. In order to work I needed the textures to have as much fidelity as possible. That made them pretty heavy, and later I found it time consuming to iterate in small changes.
The good thing is that I could make a texture to drive all the UV behaviour. The good thing, became a bad thing sometimes
Since then, I was thinking about a way to make this same shader, but more user friendly and faster to iterate on.
First I was about to keep using the texture based UV, and develop a Substance function so that anyone could make it easier.
I decided that it was a bad idea, to heavy and to much work for someone looking for faster iteration…and what about people who don’t use substance?
So, some days ago I started working on it in my free time.
I may not have that much tech knowledge, and I’m sure there is other ways to achieve this kind of effects in a more complicated and correct way, but this is what I´ve got by trying to keep it simple and not too heavy.
My final intentions are to build a tool and some functions with this so that even someone who does not know how shaders work, could make some custom animated assets for a game.
Here are some test I made with it, it´s still a WIP, but I´m pretty happy with it.
Video showing how the material animation changes with diferent textures: