[Bf-blender-cvs] [53e3e46] master: Cycles / Branched Path: Some simplifications for main loop.
Thomas Dinges
noreply at git.blender.org
Mon Jun 15 23:55:09 CEST 2015
Commit: 53e3e4633244facb76740a58f1b2b9b6c1e2a00d
Author: Thomas Dinges
Date: Mon Jun 15 23:50:29 2015 +0200
Branches: master
https://developer.blender.org/rB53e3e4633244facb76740a58f1b2b9b6c1e2a00d
Cycles / Branched Path: Some simplifications for main loop.
The main loop only handles transparent intersections from the camera ray.
Therefore we can simplify some things.
* Avoid PATH_RAY_CAMERA check, this is always true.
* Avoid path_state_next() call, we can just set transparent flag and increase transparent bounces. This way we avoid the function call and some branching.
Also remove debug num_ray_bounces++, this is incorrect here as no indirect bounce happens here.
Should be no functional changes.
===================================================================
M intern/cycles/kernel/kernel_path_branched.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index 3fa38a6..431ee78 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -197,6 +197,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
debug_data_init(&debug_data);
#endif
+ /* Main Loop
+ * Here we only handle transparency intersections from the camera ray.
+ * Indirect bounces are handled in kernel_branched_path_surface_indirect_light().
+ */
for(;;) {
/* intersect scene */
Intersection isect;
@@ -207,7 +211,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
uint lcg_state = 0;
if(kernel_data.bvh.have_curves) {
- if((kernel_data.cam.resolution == 1) && (state.flag & PATH_RAY_CAMERA)) {
+ if(kernel_data.cam.resolution == 1) {
float3 pixdiff = ray.dD.dx + ray.dD.dy;
/*pixdiff = pixdiff - dot(pixdiff, ray.D)*ray.D;*/
difl = kernel_data.curve.minimum_width * len(pixdiff) * 0.5f;
@@ -223,11 +227,8 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
#endif
#ifdef __KERNEL_DEBUG__
- if(state.flag & PATH_RAY_CAMERA) {
- debug_data.num_bvh_traversal_steps += isect.num_traversal_steps;
- debug_data.num_bvh_traversed_instances += isect.num_traversed_instances;
- }
- debug_data.num_ray_bounces++;
+ debug_data.num_bvh_traversal_steps += isect.num_traversal_steps;
+ debug_data.num_bvh_traversed_instances += isect.num_traversed_instances;
#endif
#ifdef __VOLUME__
@@ -464,7 +465,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
break;
}
- path_state_next(kg, &state, LABEL_TRANSPARENT);
+ /* Update Path State */
+ state.flag |= PATH_RAY_TRANSPARENT;
+ state.transparent_bounce++;
+
ray.P = ray_offset(sd.P, -sd.Ng);
ray.t -= sd.ray_length; /* clipping works through transparent */
More information about the Bf-blender-cvs
mailing list