diff options
-rw-r--r-- | frag.glsl | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -22,11 +22,11 @@ void main() vec3 lidir = normalize(lipos - fpos); float dif = max(dot(norm, lidir), 0.0); - float spestr = 0.5; + float speen = max(sign(dot(lidir, norm)), 0.0); vec3 vwdir = normalize(-fpos); - vec3 redir = reflect(-lidir, norm); + vec3 mid = normalize(lidir + vwdir); - float spe = spestr * pow(max(dot(vwdir, redir), 0.0), 32); + float spe = pow(max(dot(norm, mid), 0.0), 256) * speen; color = vec4((amb + dif + spe) * lico * objco, 1.0); } |