KP3Dii/Data/resources/shaders/.kp3d/map_water_f.glsl

40 lines
712 B
GLSL
Raw Permalink Normal View History

2024-07-22 07:48:42 +00:00
#version 330 core
uniform vec3 u_campos;
uniform float u_time;
in vec3 v_position;
in vec3 v_normal;
in vec2 v_texcoord;
in vec4 v_projected_normal;
flat in int v_id;
layout (location=0) out vec4 v_output;
uniform sampler2D u_texture;
float get_fog_factor(float d)
{
const float FogMax = 10.0;
const float FogMin = 0.0;
if (d >= FogMax) return 1.0;
if (d <= FogMin) return 0.0;
return 1 - (FogMax - d) / (FogMax - FogMin);
}
void main()
{
//float time = sin((u_time + float(v_id % 1) * 4.0) / 32.0) * 0.4;
float time = sin((u_time + (v_position.x - v_position.z) * 4.0) / 24.0) * 0.2;
vec4 tex2 = texture(u_texture, v_texcoord);
v_output = vec4(tex2.xyz + (float(time) / 1000.0), 0.5);
}