salmon-wallpaper/assets/test_simplelight.fragment

35 lines
938 B
Plaintext
Raw Permalink Normal View History

2013-02-10 15:24:11 +00:00
precision lowp float;
uniform sampler2D Texture;
//uniform sampler2D NormalMap;
2013-02-10 15:24:11 +00:00
uniform vec3 LightDirection;
uniform float TimeOfDayCoef1;
uniform float TimeOfDayCoef2;
//uniform float invCoef;
2013-02-10 15:24:11 +00:00
uniform vec3 TimeOfDayColor;
varying vec2 texCoord;
2013-02-10 15:24:11 +00:00
varying vec3 normVec;
varying vec3 posVec;
2013-02-10 15:24:11 +00:00
void main()
{
vec3 nvec = normalize(normVec);
float cosf = max(0.0, dot(nvec, LightDirection));
2013-02-10 15:24:11 +00:00
//gl_FragColor = vec4((texture2D(Texture, texCoord).rgb * (cosf * 0.75 + 0.25)), 1.0); //day
//gl_FragColor = vec4((texture2D(Texture, texCoord).rgb * (cosf * 0.5 + 0.25)), 1.0); //twilight
//gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + vec3(0.0, 0.1, 0.2)) * (0.4)), 1.0);
gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + TimeOfDayColor) * (cosf * TimeOfDayCoef1 + TimeOfDayCoef2)), 1.0);
2018-10-29 21:03:42 +00:00
if (posVec.y < 0.0)
{
discard;
//gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}
2013-02-10 15:24:11 +00:00
}