sine wave camera view shader

a very simple screen space shader that makes camera view sine-wavey. i wrote a post about it for begineers. i name it as sea sickness or underwater shader. it can be used in places where you either want to show dizziness or when camera is below water. however, technically it simply modifies the UVs based on sine wave only.

Note: original cover image is a GIF of 14 MB. here max upload size is 2 MB so i could not upload the preview (but you can find it in the website link above).

Shader code
shader_type canvas_item;

uniform sampler2D screen_texture : hint_screen_texture;

void fragment() {
    // Calculate UV coordinates
	vec2 uv = SCREEN_UV;
    // Offset the UV coordinates based on a sine wave
    uv.x += sin(SCREEN_UV.y * 10.0 + TIME) * 0.01; // Adjust the frequency and amplitude as needed
    uv.y += sin(SCREEN_UV.x * 10.0 + TIME) * 0.01;

    // Sample the texture using the modified UV coordinates
    COLOR = texture(screen_texture, uv);
}
Tags
screen-space, sine wave, underwater
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from mujtaba-io

3D Speed lines (fast travel) shader

Fireball or Candle fire shader

Ray marching ocean waves + atmosphere

Related shaders

Orthogonal Camera View Water Shader

Sine Morphing

another wave Progress Shader

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments