diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2018-01-11 22:03:31 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-12 03:34:28 +0300 |
commit | 322f0223d04ac36ecc72cd01c371234da6de643c (patch) | |
tree | c1295dc50a4efd3e0a68d460267345fc5f673fba /intern/cycles/render/background.cpp | |
parent | cce280dd6767bb4588a301f2b966d1b959b01f6b (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/render/background.cpp')
-rw-r--r-- | intern/cycles/render/background.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp index 3ed96732b14..df3b65be110 100644 --- a/intern/cycles/render/background.cpp +++ b/intern/cycles/render/background.cpp @@ -38,7 +38,10 @@ NODE_DEFINE(Background) SOCKET_BOOLEAN(use_shader, "Use Shader", true); SOCKET_BOOLEAN(use_ao, "Use AO", false); SOCKET_UINT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY); + SOCKET_BOOLEAN(transparent, "Transparent", false); + SOCKET_BOOLEAN(transparent_glass, "Transparent Glass", false); + SOCKET_FLOAT(transparent_roughness_threshold, "Transparent Roughness Threshold", 0.0f); SOCKET_NODE(shader, "Shader", &Shader::node_type); @@ -81,6 +84,15 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene kbackground->transparent = transparent; kbackground->surface_shader = scene->shader_manager->get_shader_id(bg_shader); + if(transparent && transparent_glass) { + /* Square twice, once for principled BSDF convention, and once for + * faster comparison in kernel with anisotropic roughness. */ + kbackground->transparent_roughness_squared_threshold = sqr(sqr(transparent_roughness_threshold)); + } + else { + kbackground->transparent_roughness_squared_threshold = -1.0f; + } + if(bg_shader->has_volume) kbackground->volume_shader = kbackground->surface_shader; else |