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
path: root/intern
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-05-17 22:23:55 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-05-17 22:23:55 +0300
commitdf26f4f63a90604c5199c2288f9dde8992abfb25 (patch)
tree7abcbed9734b97a64b7ce3c00f47f4ea31ecd171 /intern
parentb3b5d4cabb9653b9e5ddb9650378da4dc4aaac20 (diff)
parent35e73aa3472ab8c1e28feec1829fae79967322b5 (diff)
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/integrator/mnee.h32
-rw-r--r--intern/cycles/kernel/integrator/shade_surface.h4
2 files changed, 30 insertions, 6 deletions
diff --git a/intern/cycles/kernel/integrator/mnee.h b/intern/cycles/kernel/integrator/mnee.h
index 2f7b711e28c..ad83f82d091 100644
--- a/intern/cycles/kernel/integrator/mnee.h
+++ b/intern/cycles/kernel/integrator/mnee.h
@@ -807,6 +807,15 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
* and keep pdf in vertex area measure */
mnee_update_light_sample(kg, vertices[vertex_count - 1].p, ls);
+ /* Save state path bounce info in case a light path node is used in the refractive interface or
+ * light shader graph. */
+ const int transmission_bounce = INTEGRATOR_STATE(state, path, transmission_bounce);
+ const int diffuse_bounce = INTEGRATOR_STATE(state, path, diffuse_bounce);
+ const int bounce = INTEGRATOR_STATE(state, path, bounce);
+
+ /* Set diffuse bounce info . */
+ INTEGRATOR_STATE_WRITE(state, path, diffuse_bounce) = diffuse_bounce + 1;
+
/* Evaluate light sample
* in case the light has a node-based shader:
* 1. sd_mnee will be used to store light data, which is why we need to do
@@ -814,6 +823,12 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
* interface data at the end of the call for the shadow ray setup to work.
* 2. ls needs to contain the last interface data for the light shader to
* evaluate properly */
+
+ /* Set bounce info in case a light path node is used in the light shader graph. */
+ INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce + vertex_count -
+ 1;
+ INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce + vertex_count;
+
float3 light_eval = light_sample_shader_eval(kg, state, sd_mnee, ls, sd->time);
bsdf_eval_mul3(throughput, light_eval / ls->pdf);
@@ -885,6 +900,11 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
false,
LAMP_NONE);
+ /* Set bounce info in case a light path node is used in the refractive interface
+ * shader graph. */
+ INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce + vi;
+ INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce + 1 + vi;
+
/* Evaluate shader nodes at solution vi. */
shader_eval_surface<KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW>(
kg, state, sd_mnee, NULL, PATH_RAY_DIFFUSE, true);
@@ -901,6 +921,11 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
bsdf_eval_mul3(throughput, bsdf_contribution);
}
+ /* Restore original state path bounce info. */
+ INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce;
+ INTEGRATOR_STATE_WRITE(state, path, diffuse_bounce) = diffuse_bounce;
+ INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce;
+
return true;
}
@@ -1029,18 +1054,17 @@ ccl_device_forceinline int kernel_path_mnee_sample(KernelGlobals kg,
return 0;
/* Check whether the transmission depth limit is reached before continuing. */
- if (INTEGRATOR_STATE(state, path, transmission_bounce) + vertex_count >=
+ if ((INTEGRATOR_STATE(state, path, transmission_bounce) + vertex_count - 1) >=
kernel_data.integrator.max_transmission_bounce)
return 0;
/* Check whether the diffuse depth limit is reached before continuing. */
- if (INTEGRATOR_STATE(state, path, diffuse_bounce) + 1 >=
+ if ((INTEGRATOR_STATE(state, path, diffuse_bounce) + 1) >=
kernel_data.integrator.max_diffuse_bounce)
return 0;
/* Check whether the overall depth limit is reached before continuing. */
- if (INTEGRATOR_STATE(state, path, bounce) + 1 + vertex_count >=
- kernel_data.integrator.max_bounce)
+ if ((INTEGRATOR_STATE(state, path, bounce) + vertex_count) >= kernel_data.integrator.max_bounce)
return 0;
/* Mark the manifold walk valid to turn off mollification regardless of how successful the walk
diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h
index 859c314b088..896e81b80ff 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -253,13 +253,13 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg,
# ifdef __MNEE__
if (mnee_vertex_count > 0) {
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, transmission_bounce) =
- INTEGRATOR_STATE(state, path, transmission_bounce) + mnee_vertex_count;
+ INTEGRATOR_STATE(state, path, transmission_bounce) + mnee_vertex_count - 1;
INTEGRATOR_STATE_WRITE(shadow_state,
shadow_path,
diffuse_bounce) = INTEGRATOR_STATE(state, path, diffuse_bounce) + 1;
INTEGRATOR_STATE_WRITE(shadow_state,
shadow_path,
- bounce) = INTEGRATOR_STATE(state, path, bounce) + 1 + mnee_vertex_count;
+ bounce) = INTEGRATOR_STATE(state, path, bounce) + mnee_vertex_count;
}
else
# endif