This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float PhongBase(vec3 viewdir, vec3 lightdir, vec3 normal) { | |
return max(-dot(viewdir, reflect(lightdir, normal)), 0.0); | |
} | |
// Analytic specular without ambient specular might look better like this. | |
float HalfPhongBase(vec3 viewdir, vec3 lightdir, vec3 normal) { | |
return -dot(viewdir, reflect(lightdir, normal)) / 2 + 0.5; | |
} | |
// Something to approximate the longer tail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 | |
// Colorspace conversions, I haven't checked the validity of this stuff. | |
// Some of them cause discolorations when transformed to and back so I'm | |
// probably doing wrong things that I don't understand -- Caveat emptor. | |
// CIELab XYZ | |
// ---------- | |
// Matrices borrowed from Fundamentals Of Computer Graphics (3rd edition). |
NewerOlder