diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-04-05 15:42:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-04-05 17:07:44 +0300 |
commit | 252b36ce77fdb75b97b28503d1d5510980d3d51f (patch) | |
tree | c3725758baf1bed3e9915ee4c0d55b67aace1635 /intern/cycles/kernel/closure/bsdf_microfacet.h | |
parent | 92755da4712a68ed62857a1c00eb8b43916d07b6 (diff) |
Cycles: Remove unused Beckmann slope sampling code
It did not preserve stratification too well and lookup-table approach was
working much better. There are now also some more interesting forumlation
from Wenzel and OpenShadingLanguage which should work better than old code.
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf_microfacet.h')
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_microfacet.h | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 71086f2e764..4116c86df2c 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -137,44 +137,6 @@ ccl_device_inline void microfacet_beckmann_sample_slopes( *G1i = G1; -#if 0 - const float C = 1.0f - G1 * erf_a; - - /* sample slope X */ - if(randu < C) { - /* rescale randu */ - randu = randu / C; - const float w_1 = 0.5f * SQRT_PI_INV * sin_theta_i * exp_a2; - const float w_2 = cos_theta_i * (0.5f - 0.5f*erf_a); - const float p = w_1 / (w_1 + w_2); - - if(randu < p) { - randu = randu / p; - *slope_x = -sqrtf(-logf(randu*exp_a2)); - } - else { - randu = (randu - p) / (1.0f - p); - *slope_x = approx_erfinvf(randu - 1.0f - randu*erf_a); - } - } - else { - /* rescale randu */ - randu = (randu - C) / (1.0f - C); - *slope_x = approx_erfinvf((-1.0f + 2.0f*randu)*erf_a); - - const float p = (-(*slope_x)*sin_theta_i + cos_theta_i) / (2.0f*cos_theta_i); - - if(randv > p) { - *slope_x = -(*slope_x); - randv = (randv - p) / (1.0f - p); - } - else - randv = randv / p; - } - - /* sample slope Y */ - *slope_y = approx_erfinvf(2.0f*randv - 1.0f); -#else /* use precomputed table, because it better preserves stratification * of the random number pattern */ int beckmann_table_offset = kernel_data.tables.beckmann_offset; @@ -182,8 +144,6 @@ ccl_device_inline void microfacet_beckmann_sample_slopes( *slope_x = lookup_table_read_2D(kg, randu, cos_theta_i, beckmann_table_offset, BECKMANN_TABLE_SIZE, BECKMANN_TABLE_SIZE); *slope_y = approx_erfinvf(2.0f*randv - 1.0f); -#endif - } ccl_device_inline void microfacet_ggx_sample_slopes( |