Underwater Camera effect

I modified this:

2D water effect

To work with 3d and have a customizable tint.

To use: put this shader on a plane, put the plane over the camera your using.

Shader code
shader_type spatial;
render_mode unshaded;

uniform vec4 tint : hint_color; // tint effect
uniform float wave_speed = 3.0; // wave loop speed
uniform float wave_freq = 10.0; // wave vertical freq
uniform float wave_width = 1; // wave width 

void fragment(){
	vec2 scale_UV = SCREEN_UV;
	vec2 wave_uv_offset;
	wave_uv_offset.x = cos((TIME*wave_speed)+UV.x+UV.y*wave_freq*2.0)*wave_width*0.01;
	ALBEDO = texture(SCREEN_TEXTURE, SCREEN_UV+wave_uv_offset).rgb*tint.rgb;
blur, ocean, underwater, water, wave
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.

Related shaders

Move object’s DEPTH value relative to camera

Camera Distance UV Scaling

3D Wobbly Effect


Newest Most Voted
Inline Feedbacks
View all comments
1 year ago

Hi! Cool shader but I don’t understand how to use it. What do you mean by “on a plane”? Is it a Quad Mesh? A 2D Rect? Thank you

James Washington
James Washington
1 year ago
Reply to  AdrKacz

Create a meshinstance, in the “Mesh” slot inside it, give it a “PlaneMesh” (the same way you would make a box or a sphere).
Then give it a shader material, put this shader in the material you just added to the meshinstance, put the mesh in front of the camera and you should see the effect.

Last edited 1 year ago by James Washington
James Washington
James Washington
1 year ago

For anyone wanting to use this: Note that this shader doesn’t handle transparency correctly. Not sure why.

Last edited 1 year ago by James Washington
10 months ago

Set ALPHA = 0.3;