diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-04 01:34:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-04 11:27:23 +0300 |
commit | ad26407b525c15595694aab49c0a7f1669886fc8 (patch) | |
tree | ba84c2ebf809aa8b1344c9959b2676a9a3fe012f /intern/cycles/kernel/osl/osl_shader.cpp | |
parent | d8a998ce71f5dafa1f5681158bad8225ca289408 (diff) |
Cycles: Implement approximate reflectance profiles
Using this paper:
http://graphics.pixar.com/library/ApproxBSSRDF/paper.pdf
This model gives less blurry results than the Cubic and Gaussian
we had implemented:
- Cubic: https://developer.blender.org/F279670
- Burley: https://developer.blender.org/F279671
The model is called "Christensen-Burley" in the interface, which
actually should be read as "Physically based" or "Realistic".
Reviewers: juicyfruit, dingto, lukasstockner97, brecht
Reviewed By: brecht, dingto
Subscribers: robocyte
Differential Revision: https://developer.blender.org/D1759
Diffstat (limited to 'intern/cycles/kernel/osl/osl_shader.cpp')
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 8f459c8b267..8acc042cd2c 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -281,11 +281,17 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag, if(path_flag & PATH_RAY_DIFFUSE_ANCESTOR) bssrdf->radius = make_float3(0.0f, 0.0f, 0.0f); + float3 albedo = + (bssrdf->sc.type == CLOSURE_BSSRDF_BURLEY_ID) + ? bssrdf->albedo + : make_float3(0.0f, 0.0f, 0.0f); + /* create one closure for each color channel */ if(fabsf(weight.x) > 0.0f) { sc.weight = make_float3(weight.x, 0.0f, 0.0f); sc.data0 = bssrdf->radius.x; sc.data1 = 0.0f; + sc.data2 = albedo.x; sd->flag |= bssrdf_setup(&sc, sc.type); sd->closure[sd->num_closure++] = sc; } @@ -294,6 +300,7 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag, sc.weight = make_float3(0.0f, weight.y, 0.0f); sc.data0 = bssrdf->radius.y; sc.data1 = 0.0f; + sc.data2 = albedo.y; sd->flag |= bssrdf_setup(&sc, sc.type); sd->closure[sd->num_closure++] = sc; } @@ -302,6 +309,7 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag, sc.weight = make_float3(0.0f, 0.0f, weight.z); sc.data0 = bssrdf->radius.z; sc.data1 = 0.0f; + sc.data2 = albedo.z; sd->flag |= bssrdf_setup(&sc, sc.type); sd->closure[sd->num_closure++] = sc; } |