diff options
author | Eric Anholt <eric@anholt.net> | 2009-08-07 14:56:40 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-08-07 14:57:40 -0700 |
commit | 1f1c9552340400b618f0cd9c25db256c62be7e62 (patch) | |
tree | 53472098b7f77fc8de06a4cf500675cca9831568 | |
parent | 0d8ee697506809635cefa2bbf43f1e968fb752b2 (diff) |
Clean up n_dot_l and n_dot_v < 0 clamping.
This is actually a significant performance improvement, by reducing extra
comparisons and multiplies.
-rw-r--r-- | glass.frag | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -61,9 +61,6 @@ void main() Rs = 2 * schlick_fresnel(n_dot_l) * D / sqrt(n_dot_l * n_dot_v) / (ward_m * ward_n); - Rs *= step(0, n_dot_l); - Rs *= step(0, n_dot_v); - float Rd = (1 - F0) * 2; /* Ambient occlusion factor -- sample the height map we * used to generate the normal map, and reduce intensity in @@ -72,7 +69,7 @@ void main() float heightmap = texture2D(heightmap_sampler, texcoord).x; float Ra = Rd * (.8 + .2 * heightmap); - gl_FragColor = n_dot_l * step(0, n_dot_l) * + gl_FragColor = max(0, n_dot_l) * step(0, n_dot_v) * vec4(material_color.xyz * ((Rd * d + Rs * s) * Ii * shadow), material_color.w) + |