[Bf-blender-cvs] [db2d900] master: Fix T40135: cycles baking did not support branched path settings yet.
Brecht Van Lommel
noreply at git.blender.org
Mon May 19 15:22:25 CEST 2014
Commit: db2d900f74b5e7e127999faedd1b1e6f2d9db363
Author: Brecht Van Lommel
Date: Mon May 19 15:14:43 2014 +0200
https://developer.blender.org/rBdb2d900f74b5e7e127999faedd1b1e6f2d9db363
Fix T40135: cycles baking did not support branched path settings yet.
===================================================================
M intern/cycles/kernel/kernel_bake.h
M intern/cycles/kernel/kernel_path.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index b8c64af..abe3569 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -45,33 +45,63 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
/* TODO, disable the closures we won't need */
- /* sample ambient occlusion */
- if(is_combined || is_ao) {
- kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput);
- }
+#ifdef __BRANCHED_PATH__
+ if(!kernel_data.integrator.branched) {
+ /* regular path tracer */
+#endif
+
+ /* sample ambient occlusion */
+ if(is_combined || is_ao) {
+ kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput);
+ }
- /* sample subsurface scattering */
- if((is_combined || is_sss) && (sd->flag & SD_BSSRDF)) {
#ifdef __SUBSURFACE__
- /* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
- if (kernel_path_subsurface_scatter(kg, sd, &L_sample, &state, &rng, &ray, &throughput))
- is_sss = true;
+ /* sample subsurface scattering */
+ if((is_combined || is_sss) && (sd->flag & SD_BSSRDF)) {
+ /* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
+ if (kernel_path_subsurface_scatter(kg, sd, &L_sample, &state, &rng, &ray, &throughput))
+ is_sss = true;
+ }
#endif
- }
- /* sample light and BSDF */
- if((!is_sss) && (!is_ao)) {
- if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
+ /* sample light and BSDF */
+ if((!is_sss) && (!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);
+
+ /* sum and reset indirect light pass variables for the next samples */
+ path_radiance_sum_indirect(&L_sample);
+ path_radiance_reset_indirect(&L_sample);
+ }
+ }
+#ifdef __BRANCHED_PATH__
+ }
+ else {
+ /* branched path tracer */
+
+ /* sample ambient occlusion */
+ if(is_combined || is_ao) {
+ kernel_branched_path_ao(kg, sd, &L_sample, &state, &rng, throughput);
+ }
+
+#ifdef __SUBSURFACE__
+ /* sample subsurface scattering */
+ if((is_combined || is_sss) && (sd->flag & SD_BSSRDF)) {
+ /* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
+ kernel_branched_path_subsurface_scatter(kg, sd, &L_sample, &state, &rng, throughput);
+ }
#endif
- /* 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);
+ /* sample light and BSDF */
+ if((!is_sss) && (!is_ao)) {
+ kernel_branched_path_integrate_lighting(kg, &rng,
+ sd, throughput, 1.0f, &state, &L_sample);
}
+#endif
}
/* accumulate into master L */
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index c1ee3f6..3ef472b 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -982,7 +982,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
ccl_device_noinline void kernel_branched_path_integrate_lighting(KernelGlobals *kg,
RNG *rng, ShaderData *sd, float3 throughput, float num_samples_adjust,
- PathState *state, PathRadiance *L, ccl_global float *buffer)
+ PathState *state, PathRadiance *L)
{
#ifdef __EMISSION__
if(kernel_data.integrator.use_direct_light) {
@@ -1081,7 +1081,7 @@ ccl_device_noinline void kernel_branched_path_integrate_lighting(KernelGlobals *
}
#ifdef __SUBSURFACE__
-ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, PathState *state, RNG *rng, float3 throughput, ccl_global float *buffer)
+ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, PathState *state, RNG *rng, float3 throughput)
{
for(int i = 0; i< sd->num_closure; i++) {
ShaderClosure *sc = &sd->closure[i];
@@ -1113,7 +1113,7 @@ ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg, Shade
kernel_branched_path_integrate_lighting(kg, rng,
&bssrdf_sd[hit], throughput, num_samples_inv,
- &hit_state, L, buffer);
+ &hit_state, L);
}
}
@@ -1344,7 +1344,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
#ifdef __SUBSURFACE__
/* bssrdf scatter to a different location on the same object */
if(sd.flag & SD_BSSRDF) {
- kernel_branched_path_subsurface_scatter(kg, &sd, &L, &state, rng, throughput, buffer);
+ kernel_branched_path_subsurface_scatter(kg, &sd, &L, &state, rng, throughput);
}
#endif
@@ -1353,7 +1353,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
/* lighting */
kernel_branched_path_integrate_lighting(kg, rng,
- &sd, throughput, 1.0f, &hit_state, &L, buffer);
+ &sd, throughput, 1.0f, &hit_state, &L);
/* continue in case of transparency */
throughput *= shader_bsdf_transparency(kg, &sd);
More information about the Bf-blender-cvs
mailing list