Cycles: use AO factor to let user adjust intensity of AO bounces.
We are already using the AO distance, so might as well offer this extra control over the intensity. Useful when an interior scene is supposed to be significantly darker than the background shader.
This commit is contained in:
parent
8988f383c1
commit
171c4e982f
@ -1289,11 +1289,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 */
|
||||
@ -1309,6 +1306,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;
|
||||
}
|
||||
@ -1330,7 +1328,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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "device/device.h"
|
||||
#include "render/background.h"
|
||||
#include "render/integrator.h"
|
||||
#include "render/film.h"
|
||||
#include "render/light.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user