Here you have the shader for Y-based fade for sprite in atlas.
Some remarks:
- the vertex shader needs some constants: translation, rotation (euler.z in radians) and scale (x/y).
- Of course this approach is problematic for batching…
- The main.script in the attached example DOES NOTHING to optimize the use of the shader: I call go.get_world_position / scale in update.
- I have not (extensively) tested the shader!!!
The idea for the shader is very (too) simple: give it the data needed to recompute the local xy coordinates from the world-coordinates. Only this!
sprite_shader.zip (909.8 KB)