Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2018-01-11 22:03:31 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-01-12 03:34:28 +0300
commit322f0223d04ac36ecc72cd01c371234da6de643c (patch)
treec1295dc50a4efd3e0a68d460267345fc5f673fba /intern/cycles/kernel/closure
parentcce280dd6767bb4588a301f2b966d1b959b01f6b (diff)
Cycles: option to make background visible through glass transparent.
This can be enabled in the Film panel, with an option to control the transmisison roughness below which glass becomes transparent. Differential Revision: https://developer.blender.org/D2904
Diffstat (limited to 'intern/cycles/kernel/closure')
-rw-r--r--intern/cycles/kernel/closure/bsdf.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h
index e4573024e85..6f0bdb3fa38 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -38,7 +38,7 @@ CCL_NAMESPACE_BEGIN
/* Returns the square of the roughness of the closure if it has roughness,
* 0 for singular closures and 1 otherwise. */
-ccl_device_inline float bsdf_get_roughness_sqr(const ShaderClosure *sc)
+ccl_device_inline float bsdf_get_roughness_squared(const ShaderClosure *sc)
{
if(CLOSURE_IS_BSDF_SINGULAR(sc->type)) {
return 0.0f;
@@ -173,6 +173,17 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
break;
}
+ /* Test if BSDF sample should be treated as transparent for background. */
+ if(label & LABEL_TRANSMIT) {
+ float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
+
+ if(threshold_squared >= 0.0f) {
+ if(bsdf_get_roughness_squared(sc) <= threshold_squared) {
+ label |= LABEL_TRANSMIT_TRANSPARENT;
+ }
+ }
+ }
+
return label;
}