22 lines
700 B
GLSL
22 lines
700 B
GLSL
uniform sampler2D m_ColorMap;
|
||
uniform vec4 g_AmbientLightColor;
|
||
uniform vec3 m_SunDir;
|
||
uniform vec4 m_SunColor;
|
||
uniform float m_Wetness;
|
||
|
||
in vec2 varUV;
|
||
|
||
out vec4 outFragColor;
|
||
|
||
void main() {
|
||
vec4 c = texture(m_ColorMap, varUV);
|
||
if (c.a < 0.15) discard;
|
||
|
||
// Wrapped diffuse – kein Normalvektor nötig für Billboard-Quads
|
||
float light = 0.5 + 0.5 * max(dot(m_SunDir, vec3(0.0, 1.0, 0.0)), 0.0);
|
||
vec3 ambient = g_AmbientLightColor.rgb * c.rgb;
|
||
vec3 diffuse = m_SunColor.rgb * c.rgb * (1.0 - 0.18 * m_Wetness) * light;
|
||
float shine = pow(light, 12.0) * m_Wetness * 0.25;
|
||
outFragColor = vec4(min(ambient + diffuse, c.rgb * 1.5) + vec3(shine), c.a);
|
||
}
|