Merge branch 'master' into blender2.8

This commit is contained in:
Julian Eisel
2017-10-25 22:04:01 +02:00
5 changed files with 16 additions and 15 deletions

View File

@@ -1300,11 +1300,8 @@ void BlenderSync::sync_world(bool update_all)
/* AO */
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
background->ao_factor = b_light.ao_factor();
else
background->ao_factor = 0.0f;
background->use_ao = b_light.use_ambient_occlusion();
background->ao_factor = b_light.ao_factor();
background->ao_distance = b_light.distance();
/* visibility */
@@ -1320,6 +1317,7 @@ void BlenderSync::sync_world(bool update_all)
background->visibility = visibility;
}
else {
background->use_ao = false;
background->ao_factor = 0.0f;
background->ao_distance = FLT_MAX;
}
@@ -1341,7 +1339,7 @@ void BlenderSync::sync_world(bool update_all)
background->transparent = b_scene.render().alpha_mode() == BL::RenderSettings::alpha_mode_TRANSPARENT;
background->use_shader = render_layer.use_background_shader;
background->use_ao = render_layer.use_background_ao;
background->use_ao = background->use_ao && render_layer.use_background_ao;
if(background->modified(prevbackground))
background->tag_update(scene);

View File

@@ -145,6 +145,12 @@ ccl_device_forceinline void kernel_path_background(
return;
}
/* When using the ao bounces approximation, adjust background
* shader intensity with ao factor. */
if(path_state_ao_bounce(kg, state)) {
throughput *= kernel_data.background.ao_bounces_factor;
}
#ifdef __BACKGROUND__
/* sample background shader */
float3 L_background = indirect_background(kg, emission_sd, state, ray);

View File

@@ -1214,7 +1214,8 @@ typedef struct KernelBackground {
/* ambient occlusion */
float ao_factor;
float ao_distance;
float ao_pad1, ao_pad2;
float ao_bounces_factor;
float ao_pad;
} KernelBackground;
static_assert_align(KernelBackground, 16);

View File

@@ -74,14 +74,9 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
/* set shader index and transparent option */
KernelBackground *kbackground = &dscene->data.background;
if(use_ao) {
kbackground->ao_factor = ao_factor;
kbackground->ao_distance = ao_distance;
}
else {
kbackground->ao_factor = 0.0f;
kbackground->ao_distance = FLT_MAX;
}
kbackground->ao_factor = (use_ao)? ao_factor: 0.0f;
kbackground->ao_bounces_factor = ao_factor;
kbackground->ao_distance = ao_distance;
kbackground->transparent = transparent;
kbackground->surface_shader = scene->shader_manager->get_shader_id(bg_shader);

View File

@@ -15,6 +15,7 @@
*/
#include "device/device.h"
#include "render/background.h"
#include "render/integrator.h"
#include "render/film.h"
#include "render/light.h"