Files
blight/blight-assets/src/main/resources/Shaders/GrassSeed.frag

22 lines
700 B
GLSL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}