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:
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/blender/addon/ui.py13
-rw-r--r--intern/cycles/blender/blender_object.cpp12
-rw-r--r--intern/cycles/kernel/kernel_emission.h13
-rw-r--r--intern/cycles/kernel/kernel_light.h8
-rw-r--r--intern/cycles/kernel/osl/emissive.cpp4
-rw-r--r--intern/cycles/kernel/svm/emissive.h4
6 files changed, 21 insertions, 33 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 6f31732aa1f..d8f776b0114 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -366,8 +366,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- return False
- #return context.lamp and CyclesButtonsPanel.poll(context)
+ return context.lamp and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -505,17 +504,13 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
mat = context.material
cmat = mat.cycles
- layout.prop(mat, "diffuse_color", text="Viewport Color")
-
- """
split = layout.split()
-
+
col = split.column()
- col.prop(cmat, "sample_as_light")
+ col.prop(mat, "diffuse_color", text="Viewport Color")
col = split.column()
- col.prop(cmat, "homogeneous_volume")
- """
+ col.prop(cmat, "sample_as_light")
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index de41484975d..1095a3ee026 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -91,14 +91,11 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
BL::Lamp b_lamp(b_ob.data());
/* type */
-#if 0
switch(b_lamp.type()) {
case BL::Lamp::type_POINT: {
BL::PointLamp b_point_lamp(b_lamp);
light->size = b_point_lamp.shadow_soft_size();
-#endif
light->type = LIGHT_POINT;
-#if 0
break;
}
case BL::Lamp::type_SPOT: {
@@ -132,11 +129,10 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
break;
}
}
-#endif
- /* location */
+ /* location and (inverted!) direction */
light->co = make_float3(tfm.x.w, tfm.y.w, tfm.z.w);
- light->dir = make_float3(tfm.x.z, tfm.y.z, tfm.z.z);
+ light->dir = -make_float3(tfm.x.z, tfm.y.z, tfm.z.z);
/* shader */
vector<uint> used_shaders;
@@ -149,8 +145,8 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
light->shader = used_shaders[0];
/* shadow */
- //PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
- //light->cast_shadow = get_boolean(clamp, "cast_shadow");
+ PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
+ light->cast_shadow = get_boolean(clamp, "cast_shadow");
/* tag */
light->tag_update(scene);
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 13c48464088..22970f66669 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -88,14 +88,11 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
float mis_weight = power_heuristic(pdf, bsdf_pdf);
*eval *= mis_weight;
}
- else if(!(ls.shader & SHADER_AREA_LIGHT)) {
- /* ensure point light works in Watts, this should be handled
- * elsewhere but for now together with the diffuse emission
- * closure it works out to the right value */
- *eval *= 0.25f;
-
- /* XXX verify with other light types */
- }
+ /* todo: clean up these weights */
+ else if(ls.shader & SHADER_AREA_LIGHT)
+ *eval *= 0.25f; /* area lamp */
+ else if(ls.t != FLT_MAX)
+ *eval *= 0.25f*M_1_PI_F; /* point lamp */
if(ls.shader & SHADER_CAST_SHADOW) {
/* setup ray */
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 68d08a2655f..d5d47b28d59 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -75,8 +75,8 @@ __device void regular_light_sample(KernelGlobals *kg, int point,
D = distant_light_sample(D, size, randu, randv);
ls->P = D;
- ls->Ng = -D;
- ls->D = D;
+ ls->Ng = D;
+ ls->D = -D;
ls->t = FLT_MAX;
}
else {
@@ -120,9 +120,9 @@ __device float regular_light_pdf(KernelGlobals *kg,
if(t == FLT_MAX)
return pdf;
- float cos_pi = fabsf(dot(Ng, I));
+ float cos_pi = dot(Ng, I);
- if(cos_pi == 0.0f)
+ if(cos_pi <= 0.0f)
return 0.0f;
return t*t*pdf/cos_pi;
diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp
index 28d3c73e59b..2d2d6e1fdde 100644
--- a/intern/cycles/kernel/osl/emissive.cpp
+++ b/intern/cycles/kernel/osl/emissive.cpp
@@ -64,7 +64,7 @@ public:
Color3 eval (const Vec3 &Ng, const Vec3 &omega_out) const
{
float cosNO = fabsf(Ng.dot(omega_out));
- float res = cosNO > 0 ? 1.0f / float(M_PI) : 0.0f;
+ float res = cosNO > 0 ? 1.0f: 0.0f;
return Color3(res, res, res);
}
@@ -91,7 +91,7 @@ public:
const Vec3 &omega_out) const
{
float cosNO = Ng.dot(omega_out);
- return cosNO > 0 ? 1.0f / float(M_PI) : 0.0f;
+ return cosNO > 0 ? 1.0f: 0.0f;
}
};
diff --git a/intern/cycles/kernel/svm/emissive.h b/intern/cycles/kernel/svm/emissive.h
index 8bd31751fb3..e3f99e9b729 100644
--- a/intern/cycles/kernel/svm/emissive.h
+++ b/intern/cycles/kernel/svm/emissive.h
@@ -37,7 +37,7 @@ CCL_NAMESPACE_BEGIN
__device float3 emissive_eval(const float3 Ng, const float3 I)
{
float cosNO = fabsf(dot(Ng, I));
- float res = (cosNO > 0.0f)? M_1_PI_F: 0.0f;
+ float res = (cosNO > 0.0f)? 1.0f: 0.0f;
return make_float3(res, res, res);
}
@@ -48,7 +48,7 @@ __device float3 emissive_eval(const float3 Ng, const float3 I)
__device float emissive_pdf(const float3 Ng, const float3 I)
{
float cosNO = fabsf(dot(Ng, I));
- return (cosNO > 0.0f)? M_1_PI_F: 0.0f;
+ return (cosNO > 0.0f)? 1.0f: 0.0f;
}
__device float3 svm_emissive_eval(ShaderData *sd, ShaderClosure *sc)