Simple animated 3d water

Animates 2 noise textures (as normals) purely in the fragment, no vertex movement.

I attached screenshots of the 2 sample noise textures settings I have.

Shader code
shader_type spatial;

uniform vec3 uAlbedo : source_color;
uniform sampler2D uTexureNormal;
uniform sampler2D uTexureNormal2;
uniform float uNormalMix: hint_range(0.0, 1.0, 0.2) = .2;
uniform vec2 uWaveDirection = vec2(1.0, 0.0);
uniform vec2 uWaveDirection2 = vec2(0.0, 1.0);
uniform float uTimeScale: hint_range(0.0, 0.2, 0.001) = 0.0015;
uniform float uWaveScale = 1.6;

void fragment() {
	vec2 time = (TIME * uWaveDirection) * uTimeScale;
	vec2 time2 = (TIME * uWaveDirection2) * uTimeScale;
	vec3 normal1 = texture(uTexureNormal, (UV * uWaveScale) + time).rgb;
	vec3 normal2 = texture(uTexureNormal2, UV * uWaveScale + time2).rgb;
	vec3 normal = mix(normal1, normal2, uNormalMix);

	ALBEDO = uAlbedo;
	METALLIC = .0;
	ROUGHNESS = .3;
	SPECULAR = 0.1;
	NORMAL_MAP = normal;
}
Tags
water
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

3D simple animated flag shader

Pixel Animated Water

Pixelated animated water/clouds

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments