Created
July 28, 2017 12:13
-
-
Save SpineyPete/203d1b2e94000237168db3fe16e4a3f3 to your computer and use it in GitHub Desktop.
Metallic BRDF
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 | |
// and tigher highlight of metalic surfaces. | |
float MetallicPow(float x, float pwr) { | |
pwr = (pwr * x) - (pwr + 1.0); | |
return (-x / pwr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment