Еще со спекуляром херня какая-то, вообще не понимаю почему так.
Кто нибудь может объяснить, что за полоску он мне ривует.
Источник в левом дальнем углу
uniform sampler2D _position_map_texture_;
uniform sampler2D _bump_map_texture_;
uniform sampler2D _diffuse_map_texture_;
uniform float _lights_count_;
uniform vec3 _light_position_[4];
void main()
{
vec3 position = texture2D(_position_map_texture_, texcoord_1).xyz;
vec3 normal = texture2D(_bump_map_texture_, texcoord_1).xyz;
float spec = 0.0;
float light_factor = 0.0;
for (int i = 0; i < int(_lights_count_); ++i)
{
vec3 light_pos = _light_position_[i];
vec3 light_dir = normalize(light_pos - position);
vec3 latt = vec3(1.0, 0.1, 0.01) * 0.5;
float dist = length(light_pos - position);
float att = 1.0 / (latt.x + latt.y * dist + latt.z * dist * dist);
vec3 l = normalize(light_pos - position);
vec3 v = normalize(-position);
vec3 h = normalize(l + v);
spec += pow(max(0.0, dot(h, normal)), 28.0) * att;
light_factor += max(dot(normal, light_dir), 0.0) * att;
}
gl_FragColor = texture2D(_diffuse_map_texture_, texcoord_1) * light_factor + spec;
}