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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-14 14:20:12 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-25 13:44:47 +0300
commite0085bfd24da3dcfb30498ad8c579620042aa6c5 (patch)
tree5b0c9a9dab1b8cc72add4f3bf0f9a331f6a87df4 /intern/cycles/kernel/kernel_accumulate.h
parente6be2af061ba154ec633fcaf3e4caecacec521c6 (diff)
Cycles: move sss and diffuse transmission into diffuse pass
This simplifies compositors setups and will be consistent with Eevee render passes from D6331. There's a continuum between these passes and it's not clear there is much advantage to having them available separately. Differential Revision: https://developer.blender.org/D6848
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h75
1 files changed, 26 insertions, 49 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 9ea75d54c5d..79ea03f4f6f 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -36,21 +36,18 @@ ccl_device_inline void bsdf_eval_init(BsdfEval *eval,
eval->glossy = make_float3(0.0f, 0.0f, 0.0f);
eval->transmission = make_float3(0.0f, 0.0f, 0.0f);
eval->transparent = make_float3(0.0f, 0.0f, 0.0f);
- eval->subsurface = make_float3(0.0f, 0.0f, 0.0f);
- eval->scatter = make_float3(0.0f, 0.0f, 0.0f);
+ eval->volume = make_float3(0.0f, 0.0f, 0.0f);
if (type == CLOSURE_BSDF_TRANSPARENT_ID)
eval->transparent = value;
- else if (CLOSURE_IS_BSDF_DIFFUSE(type))
+ else if (CLOSURE_IS_BSDF_DIFFUSE(type) || CLOSURE_IS_BSDF_BSSRDF(type))
eval->diffuse = value;
else if (CLOSURE_IS_BSDF_GLOSSY(type))
eval->glossy = value;
else if (CLOSURE_IS_BSDF_TRANSMISSION(type))
eval->transmission = value;
- else if (CLOSURE_IS_BSDF_BSSRDF(type))
- eval->subsurface = value;
else if (CLOSURE_IS_PHASE(type))
- eval->scatter = value;
+ eval->volume = value;
}
else
#endif
@@ -73,16 +70,14 @@ ccl_device_inline void bsdf_eval_accum(BsdfEval *eval,
value *= mis_weight;
#ifdef __PASSES__
if (eval->use_light_pass) {
- if (CLOSURE_IS_BSDF_DIFFUSE(type))
+ if (CLOSURE_IS_BSDF_DIFFUSE(type) || CLOSURE_IS_BSDF_BSSRDF(type))
eval->diffuse += value;
else if (CLOSURE_IS_BSDF_GLOSSY(type))
eval->glossy += value;
else if (CLOSURE_IS_BSDF_TRANSMISSION(type))
eval->transmission += value;
- else if (CLOSURE_IS_BSDF_BSSRDF(type))
- eval->subsurface += value;
else if (CLOSURE_IS_PHASE(type))
- eval->scatter += value;
+ eval->volume += value;
/* skipping transparent, this function is used by for eval(), will be zero then */
}
@@ -98,7 +93,7 @@ ccl_device_inline bool bsdf_eval_is_zero(BsdfEval *eval)
#ifdef __PASSES__
if (eval->use_light_pass) {
return is_zero(eval->diffuse) && is_zero(eval->glossy) && is_zero(eval->transmission) &&
- is_zero(eval->transparent) && is_zero(eval->subsurface) && is_zero(eval->scatter);
+ is_zero(eval->transparent) && is_zero(eval->volume);
}
else
#endif
@@ -114,8 +109,7 @@ ccl_device_inline void bsdf_eval_mis(BsdfEval *eval, float value)
eval->diffuse *= value;
eval->glossy *= value;
eval->transmission *= value;
- eval->subsurface *= value;
- eval->scatter *= value;
+ eval->volume *= value;
/* skipping transparent, this function is used by for eval(), will be zero then */
}
@@ -144,8 +138,7 @@ ccl_device_inline void bsdf_eval_mul3(BsdfEval *eval, float3 value)
eval->diffuse *= value;
eval->glossy *= value;
eval->transmission *= value;
- eval->subsurface *= value;
- eval->scatter *= value;
+ eval->volume *= value;
/* skipping transparent, this function is used by for eval(), will be zero then */
}
@@ -160,7 +153,7 @@ ccl_device_inline float3 bsdf_eval_sum(const BsdfEval *eval)
{
#ifdef __PASSES__
if (eval->use_light_pass) {
- return eval->diffuse + eval->glossy + eval->transmission + eval->subsurface + eval->scatter;
+ return eval->diffuse + eval->glossy + eval->transmission + eval->volume;
}
else
#endif
@@ -187,19 +180,16 @@ ccl_device_inline void path_radiance_init(KernelGlobals *kg, PathRadiance *L)
L->color_diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->color_glossy = make_float3(0.0f, 0.0f, 0.0f);
L->color_transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->color_subsurface = make_float3(0.0f, 0.0f, 0.0f);
L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->direct_glossy = make_float3(0.0f, 0.0f, 0.0f);
L->direct_transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->direct_subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->direct_scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->direct_volume = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_glossy = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->indirect_subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->indirect_scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->indirect_volume = make_float3(0.0f, 0.0f, 0.0f);
L->transparent = 0.0f;
L->emission = make_float3(0.0f, 0.0f, 0.0f);
@@ -211,8 +201,7 @@ ccl_device_inline void path_radiance_init(KernelGlobals *kg, PathRadiance *L)
L->state.diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->state.glossy = make_float3(0.0f, 0.0f, 0.0f);
L->state.transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->state.subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->state.scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->state.volume = make_float3(0.0f, 0.0f, 0.0f);
L->state.direct = make_float3(0.0f, 0.0f, 0.0f);
}
else
@@ -264,11 +253,9 @@ ccl_device_inline void path_radiance_bsdf_bounce(KernelGlobals *kg,
L_state->diffuse = bsdf_eval->diffuse * value;
L_state->glossy = bsdf_eval->glossy * value;
L_state->transmission = bsdf_eval->transmission * value;
- L_state->subsurface = bsdf_eval->subsurface * value;
- L_state->scatter = bsdf_eval->scatter * value;
+ L_state->volume = bsdf_eval->volume * value;
- *throughput = L_state->diffuse + L_state->glossy + L_state->transmission +
- L_state->subsurface + L_state->scatter;
+ *throughput = L_state->diffuse + L_state->glossy + L_state->transmission + L_state->volume;
L_state->direct = *throughput;
}
@@ -449,8 +436,7 @@ ccl_device_inline void path_radiance_accum_light(KernelGlobals *kg,
L->direct_diffuse += shaded_throughput * bsdf_eval->diffuse;
L->direct_glossy += shaded_throughput * bsdf_eval->glossy;
L->direct_transmission += shaded_throughput * bsdf_eval->transmission;
- L->direct_subsurface += shaded_throughput * bsdf_eval->subsurface;
- L->direct_scatter += shaded_throughput * bsdf_eval->scatter;
+ L->direct_volume += shaded_throughput * bsdf_eval->volume;
if (is_lamp) {
L->shadow.x += shadow.x * shadow_fac;
@@ -562,15 +548,13 @@ ccl_device_inline void path_radiance_sum_indirect(PathRadiance *L)
L->direct_diffuse += L->state.diffuse * L->direct_emission;
L->direct_glossy += L->state.glossy * L->direct_emission;
L->direct_transmission += L->state.transmission * L->direct_emission;
- L->direct_subsurface += L->state.subsurface * L->direct_emission;
- L->direct_scatter += L->state.scatter * L->direct_emission;
+ L->direct_volume += L->state.volume * L->direct_emission;
L->indirect = safe_divide_color(L->indirect, L->state.direct);
L->indirect_diffuse += L->state.diffuse * L->indirect;
L->indirect_glossy += L->state.glossy * L->indirect;
L->indirect_transmission += L->state.transmission * L->indirect;
- L->indirect_subsurface += L->state.subsurface * L->indirect;
- L->indirect_scatter += L->state.scatter * L->indirect;
+ L->indirect_volume += L->state.volume * L->indirect;
}
#endif
}
@@ -582,8 +566,7 @@ ccl_device_inline void path_radiance_reset_indirect(PathRadiance *L)
L->state.diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->state.glossy = make_float3(0.0f, 0.0f, 0.0f);
L->state.transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->state.subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->state.scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->state.volume = make_float3(0.0f, 0.0f, 0.0f);
L->direct_emission = make_float3(0.0f, 0.0f, 0.0f);
L->indirect = make_float3(0.0f, 0.0f, 0.0f);
@@ -647,10 +630,10 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
if (L->use_light_pass) {
path_radiance_sum_indirect(L);
- L_direct = L->direct_diffuse + L->direct_glossy + L->direct_transmission +
- L->direct_subsurface + L->direct_scatter + L->emission;
+ L_direct = L->direct_diffuse + L->direct_glossy + L->direct_transmission + L->direct_volume +
+ L->emission;
L_indirect = L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission +
- L->indirect_subsurface + L->indirect_scatter;
+ L->indirect_volume;
if (!kernel_data.background.transparent)
L_direct += L->background;
@@ -666,14 +649,12 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->direct_glossy = make_float3(0.0f, 0.0f, 0.0f);
L->direct_transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->direct_subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->direct_scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->direct_volume = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_diffuse = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_glossy = make_float3(0.0f, 0.0f, 0.0f);
L->indirect_transmission = make_float3(0.0f, 0.0f, 0.0f);
- L->indirect_subsurface = make_float3(0.0f, 0.0f, 0.0f);
- L->indirect_scatter = make_float3(0.0f, 0.0f, 0.0f);
+ L->indirect_volume = make_float3(0.0f, 0.0f, 0.0f);
L->emission = make_float3(0.0f, 0.0f, 0.0f);
}
@@ -715,7 +696,7 @@ ccl_device_inline void path_radiance_split_denoising(KernelGlobals *kg,
kernel_assert(L->use_light_pass);
*clean = L->emission + L->background;
- *noisy = L->direct_scatter + L->indirect_scatter;
+ *noisy = L->direct_volume + L->indirect_volume;
# define ADD_COMPONENT(flag, component) \
if (kernel_data.film.denoising_flags & flag) \
@@ -729,8 +710,6 @@ ccl_device_inline void path_radiance_split_denoising(KernelGlobals *kg,
ADD_COMPONENT(DENOISING_CLEAN_GLOSSY_IND, L->indirect_glossy);
ADD_COMPONENT(DENOISING_CLEAN_TRANSMISSION_DIR, L->direct_transmission);
ADD_COMPONENT(DENOISING_CLEAN_TRANSMISSION_IND, L->indirect_transmission);
- ADD_COMPONENT(DENOISING_CLEAN_SUBSURFACE_DIR, L->direct_subsurface);
- ADD_COMPONENT(DENOISING_CLEAN_SUBSURFACE_IND, L->indirect_subsurface);
# undef ADD_COMPONENT
#else
*noisy = L->emission;
@@ -767,14 +746,12 @@ ccl_device_inline void path_radiance_accum_sample(PathRadiance *L, PathRadiance
safe_float3_add(L->direct_diffuse, L_sample->direct_diffuse);
safe_float3_add(L->direct_glossy, L_sample->direct_glossy);
safe_float3_add(L->direct_transmission, L_sample->direct_transmission);
- safe_float3_add(L->direct_subsurface, L_sample->direct_subsurface);
- safe_float3_add(L->direct_scatter, L_sample->direct_scatter);
+ safe_float3_add(L->direct_volume, L_sample->direct_volume);
safe_float3_add(L->indirect_diffuse, L_sample->indirect_diffuse);
safe_float3_add(L->indirect_glossy, L_sample->indirect_glossy);
safe_float3_add(L->indirect_transmission, L_sample->indirect_transmission);
- safe_float3_add(L->indirect_subsurface, L_sample->indirect_subsurface);
- safe_float3_add(L->indirect_scatter, L_sample->indirect_scatter);
+ safe_float3_add(L->indirect_volume, L_sample->indirect_volume);
safe_float3_add(L->background, L_sample->background);
safe_float3_add(L->ao, L_sample->ao);