[Bf-blender-cvs] [ec28843066e] split-kernel-faster-building: Cycles: Only use first lamp in indirect_lamp_emission
Mai Lavelle
noreply at git.blender.org
Mon Nov 27 08:52:15 CET 2017
Commit: ec28843066e92c5ed9c6389b8165f68f21240a5f
Author: Mai Lavelle
Date: Sun Nov 26 23:34:07 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rBec28843066e92c5ed9c6389b8165f68f21240a5f
Cycles: Only use first lamp in indirect_lamp_emission
Produces different results when lamps overlap from POV of a ray, but allows
for this function to be split. The differences probably wont be noticeable
in most scenes. Old behavior could be reattained by placing lamps
into the BVH.
===================================================================
M intern/cycles/kernel/kernel_emission.h
M intern/cycles/kernel/kernel_light.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index fa54a7d756a..295fa978e15 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -287,10 +287,11 @@ ccl_device_noinline bool indirect_lamp_emission(KernelGlobals *kg,
*emission = make_float3(0.0f, 0.0f, 0.0f);
- for(int lamp = 0; lamp < kernel_data.integrator.num_all_lights; lamp++) {
- LightSample ls;
+ LightSample ls;
+ ls.t = ray->t;
- if(!lamp_light_eval(kg, lamp, ray->P, ray->D, ray->t, &ls))
+ for(int lamp = 0; lamp < kernel_data.integrator.num_all_lights; lamp++) {
+ if(!lamp_light_eval(kg, lamp, ray->P, ray->D, ls.t, &ls))
continue;
#ifdef __PASSES__
@@ -305,6 +306,10 @@ ccl_device_noinline bool indirect_lamp_emission(KernelGlobals *kg,
}
#endif
+ hit_lamp = true;
+ }
+
+ if(hit_lamp) {
float3 L = direct_emissive_eval(kg,
emission_sd,
&ls,
@@ -333,7 +338,6 @@ ccl_device_noinline bool indirect_lamp_emission(KernelGlobals *kg,
}
*emission += L;
- hit_lamp = true;
}
return hit_lamp;
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 1a3ae4c1f32..6defef13d1e 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -617,16 +617,9 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
float4 data1 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 1);
LightType type = (LightType)__float_as_int(data0.x);
- ls->type = type;
- ls->shader = __float_as_int(data1.x);
- ls->object = PRIM_NONE;
- ls->prim = PRIM_NONE;
- ls->lamp = lamp;
- /* todo: missing texture coordinates */
- ls->u = 0.0f;
- ls->v = 0.0f;
+ int shader = __float_as_int(data1.x);
- if(!(ls->shader & SHADER_USE_MIS))
+ if(!(shader & SHADER_USE_MIS))
return false;
if(type == LIGHT_DISTANT) {
@@ -665,6 +658,10 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
ls->D = D;
ls->t = FLT_MAX;
+ /* todo: missing texture coordinates */
+ ls->u = 0.0f;
+ ls->v = 0.0f;
+
/* compute pdf */
float invarea = data1.w;
ls->pdf = invarea/(costheta*costheta*costheta);
@@ -734,6 +731,10 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
return false;
}
+ /* todo: missing texture coordinates */
+ ls->u = 0.0f;
+ ls->v = 0.0f;
+
ls->D = D;
ls->Ng = Ng;
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
@@ -743,6 +744,12 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
return false;
}
+ ls->type = type;
+ ls->shader = shader;
+ ls->object = PRIM_NONE;
+ ls->prim = PRIM_NONE;
+ ls->lamp = lamp;
+
ls->pdf *= kernel_data.integrator.pdf_lights;
return true;
More information about the Bf-blender-cvs
mailing list