[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40634] branches/cycles/intern/cycles: Cycles: internal changes that should have no effect on user level yet, added
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Sep 27 22:37:25 CEST 2011
Revision: 40634
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40634
Author: blendix
Date: 2011-09-27 20:37:24 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Cycles: internal changes that should have no effect on user level yet, added
shader flags for various purposes, and some code for light types other than
points.
Modified Paths:
--------------
branches/cycles/intern/cycles/blender/addon/properties.py
branches/cycles/intern/cycles/blender/addon/ui.py
branches/cycles/intern/cycles/blender/blender_object.cpp
branches/cycles/intern/cycles/blender/blender_shader.cpp
branches/cycles/intern/cycles/blender/blender_sync.cpp
branches/cycles/intern/cycles/kernel/kernel.cpp
branches/cycles/intern/cycles/kernel/kernel_emission.h
branches/cycles/intern/cycles/kernel/kernel_light.h
branches/cycles/intern/cycles/kernel/kernel_montecarlo.h
branches/cycles/intern/cycles/kernel/kernel_path.h
branches/cycles/intern/cycles/kernel/kernel_shader.h
branches/cycles/intern/cycles/kernel/kernel_textures.h
branches/cycles/intern/cycles/kernel/kernel_types.h
branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp
branches/cycles/intern/cycles/kernel/svm/svm.h
branches/cycles/intern/cycles/kernel/svm/svm_bsdf.h
branches/cycles/intern/cycles/render/light.cpp
branches/cycles/intern/cycles/render/light.h
branches/cycles/intern/cycles/render/nodes.cpp
branches/cycles/intern/cycles/render/object.cpp
branches/cycles/intern/cycles/render/osl.cpp
branches/cycles/intern/cycles/render/scene.h
branches/cycles/intern/cycles/render/shader.cpp
branches/cycles/intern/cycles/render/shader.h
branches/cycles/intern/cycles/render/svm.cpp
branches/cycles/intern/cycles/util/util_math.h
Modified: branches/cycles/intern/cycles/blender/addon/properties.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/properties.py 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/blender/addon/properties.py 2011-09-27 20:37:24 UTC (rev 40634)
@@ -116,11 +116,23 @@
@classmethod
def register(cls):
bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles material settings")
+ cls.sample_as_light = BoolProperty(name="Sample as Light", description="Use direct light sampling, to reduce noise for small or strong emitting materials", default=False)
+ cls.homogeneous_volume = BoolProperty(name="Homogeneous Volume", description="When using volume rendering, assume volume has the same density everywhere, for faster rendering", default=False)
@classmethod
def unregister(cls):
del bpy.types.Material.cycles
+class CyclesLampSettings(bpy.types.PropertyGroup):
+ @classmethod
+ def register(cls):
+ bpy.types.Lamp.cycles = PointerProperty(type=cls, name="Cycles Lamp Settings", description="Cycles lamp settings")
+ cls.cast_shadow = BoolProperty(name="Cast Shadow", description="Lamp casts shadows", default=True)
+
+ @classmethod
+ def unregister(cls):
+ del bpy.types.Lamp.cycles
+
class CyclesWorldSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -168,6 +180,7 @@
bpy.utils.register_class(CyclesRenderSettings)
bpy.utils.register_class(CyclesCameraSettings)
bpy.utils.register_class(CyclesMaterialSettings)
+ bpy.utils.register_class(CyclesLampSettings)
bpy.utils.register_class(CyclesWorldSettings)
bpy.utils.register_class(CyclesVisibilitySettings)
bpy.utils.register_class(CyclesMeshSettings)
@@ -176,6 +189,7 @@
bpy.utils.unregister_class(CyclesRenderSettings)
bpy.utils.unregister_class(CyclesCameraSettings)
bpy.utils.unregister_class(CyclesMaterialSettings)
+ bpy.utils.unregister_class(CyclesLampSettings)
bpy.utils.unregister_class(CyclesWorldSettings)
bpy.utils.unregister_class(CyclesMeshSettings)
bpy.utils.unregister_class(CyclesVisibilitySettings)
Modified: branches/cycles/intern/cycles/blender/addon/ui.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/ui.py 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/blender/addon/ui.py 2011-09-27 20:37:24 UTC (rev 40634)
@@ -360,11 +360,52 @@
layout.template_node_view(ntree, node, input);
class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
- bl_label = "Surface"
+ bl_label = "Lamp"
bl_context = "data"
+ bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
+ return False
+ #return context.lamp and CyclesButtonsPanel.poll(context)
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp
+ clamp = lamp.cycles
+
+ layout.prop(lamp, "type", expand=True)
+
+ split = layout.split()
+ col = split.column(align=True)
+
+ if lamp.type in ('POINT', 'SUN', 'SPOT'):
+ col.prop(lamp, "shadow_soft_size", text="Size")
+ elif lamp.type == 'AREA':
+ col.prop(lamp, "shape", text="")
+ sub = col.column(align=True)
+
+ if lamp.shape == 'SQUARE':
+ sub.prop(lamp, "size")
+ elif lamp.shape == 'RECTANGLE':
+ sub.prop(lamp, "size", text="Size X")
+ sub.prop(lamp, "size_y", text="Size Y")
+
+ col = split.column()
+ col.prop(clamp, "cast_shadow")
+
+ if lamp.type == 'SPOT':
+ layout.label(text="Not supported, interpreted as point lamp.")
+ elif lamp.type == 'HEMI':
+ layout.label(text="Not supported, interpreted as sun lamp.")
+
+class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
+ bl_label = "Nodes"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
return context.lamp and CyclesButtonsPanel.poll(context)
def draw(self, context):
@@ -399,8 +440,8 @@
layout = self.layout
layout.active = False
- mat = context.world
- panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Volume')
+ world = context.world
+ panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
@@ -429,8 +470,12 @@
layout.active = False
mat = context.material
+ cmat = mat.cycles
+
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
+ layout.prop(cmat, "homogeneous_volume")
+
class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
bl_label = "Displacement"
bl_context = "material"
@@ -452,18 +497,23 @@
@classmethod
def poll(cls, context):
- # return context.material and CyclesButtonsPanel.poll(context)
return False
+ #return context.material and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
mat = context.material
+ cmat = mat.cycles
+
+ split = layout.split()
- row = layout.row()
- row.label(text="Light Group:")
- row.prop(mat, "light_group", text="")
+ col = split.column()
+ col.prop(cmat, "sample_as_light")
+ col = split.column()
+ col.prop(cmat, "homogeneous_volume")
+
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""
bl_context = "texture"
Modified: branches/cycles/intern/cycles/blender/blender_object.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_object.cpp 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/blender/blender_object.cpp 2011-09-27 20:37:24 UTC (rev 40634)
@@ -87,12 +87,58 @@
if(!light_map.sync(&light, b_ob, b_parent, key))
return;
+
+ 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: {
+ BL::SpotLamp b_spot_lamp(b_lamp);
+ light->size = b_spot_lamp.shadow_soft_size();
+ light->type = LIGHT_POINT;
+ break;
+ }
+ case BL::Lamp::type_HEMI: {
+ light->type = LIGHT_DISTANT;
+ light->size = 0.0f;
+ break;
+ }
+ case BL::Lamp::type_SUN: {
+ BL::SunLamp b_sun_lamp(b_lamp);
+ light->size = b_sun_lamp.shadow_soft_size();
+ light->type = LIGHT_DISTANT;
+ break;
+ }
+ case BL::Lamp::type_AREA: {
+ BL::AreaLamp b_area_lamp(b_lamp);
+ light->size = 1.0f;
+ light->axisu = make_float3(tfm.x.x, tfm.y.x, tfm.z.x);
+ light->axisv = make_float3(tfm.x.y, tfm.y.y, tfm.z.y);
+ light->sizeu = b_area_lamp.size();
+ if(b_area_lamp.shape() == BL::AreaLamp::shape_RECTANGLE)
+ light->sizev = b_area_lamp.size_y();
+ else
+ light->sizev = light->sizeu;
+ light->type = LIGHT_AREA;
+ break;
+ }
+ }
+#endif
+
/* location */
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);
/* shader */
- BL::Lamp b_lamp(b_ob.data());
vector<uint> used_shaders;
find_shader(b_lamp, used_shaders);
@@ -102,6 +148,10 @@
light->shader = used_shaders[0];
+ /* shadow */
+ //PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
+ //light->cast_shadow = get_boolean(clamp, "cast_shadow");
+
/* tag */
light->tag_update(scene);
}
Modified: branches/cycles/intern/cycles/blender/blender_shader.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_shader.cpp 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/blender/blender_shader.cpp 2011-09-27 20:37:24 UTC (rev 40634)
@@ -587,6 +587,11 @@
graph->connect(closure->output("BSDF"), out->input("Surface"));
}
+ /* settings */
+ PointerRNA cmat = RNA_pointer_get(&b_mat->ptr, "cycles");
+ //shader->sample_as_light = get_boolean(cmat, "sample_as_light");
+ shader->homogeneous_volume = get_boolean(cmat, "homogeneous_volume");
+
shader->set_graph(graph);
shader->tag_update(scene);
}
Modified: branches/cycles/intern/cycles/blender/blender_sync.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-09-27 20:37:24 UTC (rev 40634)
@@ -83,12 +83,17 @@
object_map.set_recalc(*b_ob);
light_map.set_recalc(*b_ob);
}
+
if(object_is_mesh(*b_ob)) {
if(b_ob->recalc_data() || b_ob->data().recalc()) {
BL::ID key = object_is_modified(*b_ob)? *b_ob: b_ob->data();
mesh_map.set_recalc(key);
}
}
+ else if(object_is_light(*b_ob)) {
+ if(b_ob->recalc_data() || b_ob->data().recalc())
+ light_map.set_recalc(*b_ob);
+ }
}
BL::BlendData::meshes_iterator b_mesh;
Modified: branches/cycles/intern/cycles/kernel/kernel.cpp
===================================================================
--- branches/cycles/intern/cycles/kernel/kernel.cpp 2011-09-27 20:03:16 UTC (rev 40633)
+++ branches/cycles/intern/cycles/kernel/kernel.cpp 2011-09-27 20:37:24 UTC (rev 40634)
@@ -73,82 +73,17 @@
void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height)
{
- if(strcmp(name, "__bvh_nodes") == 0) {
- kg->__bvh_nodes.data = (float4*)mem;
- kg->__bvh_nodes.width = width;
+ if(0) {
}
- else if(strcmp(name, "__objects") == 0) {
- kg->__objects.data = (float4*)mem;
- kg->__objects.width = width;
+
+#define KERNEL_TEX(type, ttype, tname) \
+ else if(strcmp(name, #tname) == 0) { \
+ kg->tname.data = (type*)mem; \
+ kg->tname.width = width; \
}
- else if(strcmp(name, "__tri_normal") == 0) {
- kg->__tri_normal.data = (float4*)mem;
- kg->__tri_normal.width = width;
- }
- else if(strcmp(name, "__tri_woop") == 0) {
- kg->__tri_woop.data = (float4*)mem;
- kg->__tri_woop.width = width;
- }
- else if(strcmp(name, "__prim_visibility") == 0) {
- kg->__prim_visibility.data = (uint*)mem;
- kg->__prim_visibility.width = width;
- }
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list