Alright so my question is about texture manipulation in Flash Stage3D
/ Context3D
using AGAL for the shader language. But I'm pretty sure this could be applicable in other situations involving GPU programming.
So the goal is, if I wish to have a "scrolling" animation on a certain tile (like a tile of water), can I still have that texture packed along with all the rest of my sprite assets? Or does it have to be alone to avoid bleeding nearby assets?
From what I can understand, when the FragmentShader samples the portion of the texture offsetted during a scroll animation, any coordinates outside the desired texture will reveal incorrect nearby textures.
Some example to clarify:
- Fluid motion (lava, water waves, acid bubbles);
- Background motion (cloud, trees, houses);
- Directional indicators (lines on a conveyor belt, race-circuit dash regions);
Do I need to use some extra operations to wrap the texture if it tries to sample beyond a certain point? How could those constraints be defined / transferred to the FragmentShader?
- UPDATE -
To clarify, I would like to scroll only on 1 single tile that would be part of a SpriteSheet / TextureAtlas (meaning, mixed with other existing sprites part of a game / project).
Imagine you had something like this (but better artwork, of course):
So a 256 x 256 Texture with a "Wavy Water" tile in the top-left corner (128 x 128 in dimensions).
How would you write a shader that can scroll through ONLY the water portion to give a sense of motion without running over the adjacent textures (ex: faces and cars).
How would you handle situations where the Quad is much larger than the texture and could repeat many times as well in combination to being able to scroll it?