Hi I’m new to shaders and I’m trying to create one that appears as a ball bouncing. So far i managed to get the effect I wanted but the issue is the bouncyness extends far beyond the actual borders of the image on the upper edge(see screenshot)
Is there a way to limit the extension on the upper side ? (image is 250x250)
I’ve tried using max() or clamp() on the y axis to -125 but i only seem to mess it up more cause I’m a noob and bad at math and logic
Your issue was that sin() oscillates from -1 and 1. When it was negative, it overextended your image bounds. By adding 1 before multiplying by amount, we avoid negative offsets.