Created
October 25, 2024 09:06
-
-
Save CaptainGPU/92c55079535a8edea4ba584023130cce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
// Розмір екрану | |
uniform vec2 u_resolution; | |
// Значення часу | |
uniform float u_time; | |
// Текстура котика | |
uniform sampler2D u_texture_1; | |
// Кількість клитин | |
float cels = 10.; | |
// Інтенсивність ефекту | |
float power = .01; | |
const float PI = 3.14159265359; | |
void main() | |
{ | |
// Розраховуємо uv-координати в просторі екрана | |
vec2 uv = gl_FragCoord.xy / u_resolution.xy; | |
// Швідкисть ефекту | |
float speed = 10. * u_time; | |
// Розраховуємо викривлення | |
float warpX = sin(((1. - uv.y) * (cels * PI)) + (speed)) * power; | |
float warpY = sin(((1. - uv.x) * (cels * PI)) + (speed)) * power; | |
// Додаємо до uv-координат викривлення | |
uv += vec2(warpX, warpY); | |
// Вибераємо з текстури колір за допомогою викривлених uv-координат | |
vec4 color = texture2D(u_texture_1, uv).rgba; | |
gl_FragColor = color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment