forked from bartvdbraak/blender
Cycles-Bake: Ambient Occlusion needs to be computed for COMBINED
Now the COMBINED pass includes the Ambient Occlusion. This was not reported anywhere, but while working in the Subsurface Scattering I realize we needed this fix for combined.
This commit is contained in:
parent
79c345acc2
commit
08bf531956
@ -16,7 +16,8 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng, bool is_ao)
|
||||
ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng,
|
||||
bool is_combined, bool is_ao)
|
||||
{
|
||||
int samples = kernel_data.integrator.aa_samples;
|
||||
|
||||
@ -45,22 +46,24 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
|
||||
/* TODO, disable the closures we won't need */
|
||||
|
||||
/* sample ambient occlusion */
|
||||
if(is_ao) {
|
||||
if(is_combined || is_ao) {
|
||||
kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput);
|
||||
}
|
||||
|
||||
/* sample light and BSDF */
|
||||
else if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
|
||||
if(!is_ao) {
|
||||
if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
|
||||
#ifdef __LAMP_MIS__
|
||||
state.ray_t = 0.0f;
|
||||
state.ray_t = 0.0f;
|
||||
#endif
|
||||
|
||||
/* compute indirect light */
|
||||
kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample);
|
||||
/* compute indirect light */
|
||||
kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample);
|
||||
|
||||
/* sum and reset indirect light pass variables for the next samples */
|
||||
path_radiance_sum_indirect(&L_sample);
|
||||
path_radiance_reset_indirect(&L_sample);
|
||||
/* sum and reset indirect light pass variables for the next samples */
|
||||
path_radiance_sum_indirect(&L_sample);
|
||||
path_radiance_reset_indirect(&L_sample);
|
||||
}
|
||||
}
|
||||
|
||||
/* accumulate into master L */
|
||||
@ -123,7 +126,8 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
|
||||
|
||||
if(is_light_pass(type)) {
|
||||
RNG rng = cmj_hash(i, 0);
|
||||
compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO));
|
||||
compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_COMBINED),
|
||||
(type == SHADER_EVAL_AO));
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
|
Loading…
Reference in New Issue
Block a user