Hi everyone.

Is it possible to make a shader that doesn't warp my sprites, in the sense that the pixels remain the same size and shape?

Basically, I'm looking to create a water reflection effect that looks like it was animated with frames, with the pixels moving position slightly, at different speeds, and then back again, to give a ripple effect. Can I do this with shaders or will I need to animate this?

Thanks

I think floor/ceil/rounding the pixel positions might give you what you want, if I understood what you want correct.

I guess I'll give it a try. Do you have an example of some basic code I could use?

Not at hand, no. If you better explained what exactly you wanted I might be able to whip something up perhaps, but I'm not psychic.

Sorry if my explanation was strange. My idea is something that will move the pixels slightly from side to side, but not all at once, more like in horizontal layers/lines going across the sprite. Like splitting it, you could say.

So like using a waveform to displace the texture coordinates? Shouldn't be too hard. I'll mull it over and will try and see if I can't build a simple example sometime tomorrow.

Thank you very much. I'm likely doing something wrong, but I can't figure out how to implement it in my game. I suppose it isn't as simple as copying the code to my sprite's shader and adding those water textures? Sorry for the newbie questions.

No, it isn't. And this was just an example. I am creating a gradient basically from scratch there that acts as a mask for one of the textures over the other. Some variables are currently hard-coded in there. Otherwise you'd have to add some uniforms and then override those uniform variables and control them from script external to the shader.

3 years later