summaryrefslogtreecommitdiffstats
path: root/custom_shaders/liquid.gdshader
blob: b5b913b7dcea27a762c542f100e548b3cdbfe984 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
shader_type spatial;

//frag shader variables
uniform vec4 albedo : hint_color;
uniform float alpha : hint_range(0.0, 1.0);
uniform float normal_speed : hint_range(0.0, 1.0);
uniform float normal_map_scale : hint_range(0.0, 10.0);
uniform float roughness : hint_range(0.0, 1.0);
uniform sampler2D normal : hint_normal;

//Vertex shader variables
uniform float wave_speed : hint_range(0.0, 10.0);
uniform float wave_height : hint_range(0.0, 10.0);


void fragment(){
	
	vec2 moving_uv = UV + (TIME * normal_speed);
	
	ALBEDO = albedo.rgb;
	ALPHA = alpha;
	ROUGHNESS = roughness;
	NORMALMAP = texture(normal, moving_uv * normal_map_scale).xyz;
}

void vertex() {
	VERTEX.y = sin(TIME + VERTEX.x * wave_speed) * wave_height;
}