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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-11 00:34:34 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-11 00:34:34 +0400
commit9d3ad07f1417fdc959ee3d3e86a7bff1c2ee6d80 (patch)
tree48ad22788cee5d1ded2bbbfc6edb7003fd054b6f
parentd16a608f6d5cfdb45c0a72aaa7c5cbc0ebe19928 (diff)
Cycles: ray visibility panel is now also available for the world, works same as
meshes and lamps. The light path node already made this possible but it's a bit faster to render this way and convenient.
-rw-r--r--intern/cycles/blender/addon/properties.py6
-rw-r--r--intern/cycles/blender/addon/ui.py27
-rw-r--r--intern/cycles/blender/blender_shader.cpp13
-rw-r--r--intern/cycles/kernel/kernel_emission.h20
-rw-r--r--intern/cycles/kernel/kernel_types.h3
-rw-r--r--intern/cycles/render/background.cpp14
-rw-r--r--intern/cycles/render/background.h2
-rw-r--r--intern/cycles/render/integrator.cpp3
8 files changed, 78 insertions, 10 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 7ea84659764..0c6cf9f513a 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -589,6 +589,12 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
type=cls,
)
+ bpy.types.World.cycles_visibility = PointerProperty(
+ name="Cycles Visibility Settings",
+ description="Cycles visibility settings",
+ type=cls,
+ )
+
cls.camera = BoolProperty(
name="Camera",
description="Object visibility for camera rays",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 8950b4f83c4..a30622a36ac 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -542,7 +542,9 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
flow.prop(visibility, "diffuse")
flow.prop(visibility, "glossy")
flow.prop(visibility, "transmission")
- flow.prop(visibility, "shadow")
+
+ if ob.type != 'LAMP':
+ flow.prop(visibility, "shadow")
def find_node(material, nodetype):
@@ -777,6 +779,29 @@ class CyclesWorld_PT_mist(CyclesButtonsPanel, Panel):
layout.prop(world.mist_settings, "falloff")
+class CyclesWorld_PT_ray_visibility(CyclesButtonsPanel, Panel):
+ bl_label = "Ray Visibility"
+ bl_context = "world"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return CyclesButtonsPanel.poll(context) and context.world
+
+ def draw(self, context):
+ layout = self.layout
+
+ world = context.world
+ visibility = world.cycles_visibility
+
+ flow = layout.column_flow()
+
+ flow.prop(visibility, "camera")
+ flow.prop(visibility, "diffuse")
+ flow.prop(visibility, "glossy")
+ flow.prop(visibility, "transmission")
+
+
class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
bl_label = "Settings"
bl_context = "world"
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 722b3919580..a5fe5dbf12f 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -895,8 +895,8 @@ void BlenderSync::sync_world(bool update_all)
graph->connect(closure->output("Background"), out->input("Surface"));
}
- /* AO */
if(b_world) {
+ /* AO */
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
@@ -905,6 +905,17 @@ void BlenderSync::sync_world(bool update_all)
background->ao_factor = 0.0f;
background->ao_distance = b_light.distance();
+
+ /* visibility */
+ PointerRNA cvisibility = RNA_pointer_get(&b_world.ptr, "cycles_visibility");
+ uint visibility = 0;
+
+ visibility |= get_boolean(cvisibility, "camera")? PATH_RAY_CAMERA: 0;
+ visibility |= get_boolean(cvisibility, "diffuse")? PATH_RAY_DIFFUSE: 0;
+ visibility |= get_boolean(cvisibility, "glossy")? PATH_RAY_GLOSSY: 0;
+ visibility |= get_boolean(cvisibility, "transmission")? PATH_RAY_TRANSMIT: 0;
+
+ background->visibility = visibility;
}
shader->set_graph(graph);
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 869c8539809..c430a40d814 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -199,11 +199,9 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p
#ifdef __PASSES__
/* use visibility flag to skip lights */
if(ls.shader & SHADER_EXCLUDE_ANY) {
- if((ls.shader & SHADER_EXCLUDE_DIFFUSE) && (path_flag & PATH_RAY_DIFFUSE))
- return false;
- if((ls.shader & SHADER_EXCLUDE_GLOSSY) && (path_flag & PATH_RAY_GLOSSY))
- return false;
- if((ls.shader & SHADER_EXCLUDE_TRANSMIT) && (path_flag & PATH_RAY_TRANSMIT))
+ if(((ls.shader & SHADER_EXCLUDE_DIFFUSE) && (path_flag & PATH_RAY_DIFFUSE)) ||
+ ((ls.shader & SHADER_EXCLUDE_GLOSSY) && (path_flag & PATH_RAY_GLOSSY)) ||
+ ((ls.shader & SHADER_EXCLUDE_TRANSMIT) && (path_flag & PATH_RAY_TRANSMIT)))
return false;
}
#endif
@@ -229,9 +227,21 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p
__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf)
{
#ifdef __BACKGROUND__
+ int shader = kernel_data.background.shader;
+
+ /* use visibility flag to skip lights */
+ if(shader & SHADER_EXCLUDE_ANY) {
+ if(((shader & SHADER_EXCLUDE_DIFFUSE) && (path_flag & PATH_RAY_DIFFUSE)) ||
+ ((shader & SHADER_EXCLUDE_GLOSSY) && (path_flag & PATH_RAY_GLOSSY)) ||
+ ((shader & SHADER_EXCLUDE_TRANSMIT) && (path_flag & PATH_RAY_TRANSMIT)) ||
+ ((shader & SHADER_EXCLUDE_CAMERA) && (path_flag & PATH_RAY_CAMERA)))
+ return make_float3(0.0f, 0.0f, 0.0f);
+ }
+
/* evaluate background closure */
ShaderData sd;
shader_setup_from_background(kg, &sd, ray);
+
float3 L = shader_eval_background(kg, &sd, path_flag, SHADER_CONTEXT_EMISSION);
#ifdef __BACKGROUND_MIS__
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 9785f2e8320..6ae3b10595c 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -329,7 +329,8 @@ typedef enum ShaderFlag {
SHADER_EXCLUDE_DIFFUSE = (1 << 27),
SHADER_EXCLUDE_GLOSSY = (1 << 26),
SHADER_EXCLUDE_TRANSMIT = (1 << 25),
- SHADER_EXCLUDE_ANY = (SHADER_EXCLUDE_DIFFUSE|SHADER_EXCLUDE_GLOSSY|SHADER_EXCLUDE_TRANSMIT),
+ SHADER_EXCLUDE_CAMERA = (1 << 24),
+ SHADER_EXCLUDE_ANY = (SHADER_EXCLUDE_DIFFUSE|SHADER_EXCLUDE_GLOSSY|SHADER_EXCLUDE_TRANSMIT|SHADER_EXCLUDE_CAMERA),
SHADER_MASK = ~(SHADER_SMOOTH_NORMAL|SHADER_CAST_SHADOW|SHADER_AREA_LIGHT|SHADER_USE_MIS|SHADER_EXCLUDE_ANY)
} ShaderFlag;
diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp
index 76d26dd34b5..3513665f256 100644
--- a/intern/cycles/render/background.cpp
+++ b/intern/cycles/render/background.cpp
@@ -37,6 +37,8 @@ Background::Background()
use = true;
+ visibility = ~0;
+
transparent = false;
need_update = true;
}
@@ -64,6 +66,15 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
else
kbackground->shader = scene->shader_manager->get_shader_id(scene->default_empty);
+ if(!(visibility & PATH_RAY_DIFFUSE))
+ kbackground->shader |= SHADER_EXCLUDE_DIFFUSE;
+ if(!(visibility & PATH_RAY_GLOSSY))
+ kbackground->shader |= SHADER_EXCLUDE_GLOSSY;
+ if(!(visibility & PATH_RAY_TRANSMIT))
+ kbackground->shader |= SHADER_EXCLUDE_TRANSMIT;
+ if(!(visibility & PATH_RAY_CAMERA))
+ kbackground->shader |= SHADER_EXCLUDE_CAMERA;
+
need_update = false;
}
@@ -76,7 +87,8 @@ bool Background::modified(const Background& background)
return !(transparent == background.transparent &&
use == background.use &&
ao_factor == background.ao_factor &&
- ao_distance == background.ao_distance);
+ ao_distance == background.ao_distance &&
+ visibility == background.visibility);
}
void Background::tag_update(Scene *scene)
diff --git a/intern/cycles/render/background.h b/intern/cycles/render/background.h
index 3c1cd3915e5..e0c0c42de37 100644
--- a/intern/cycles/render/background.h
+++ b/intern/cycles/render/background.h
@@ -34,6 +34,8 @@ public:
bool use;
+ uint visibility;
+
bool transparent;
bool need_update;
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index cc369e7abc9..796746e828f 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -173,7 +173,8 @@ bool Integrator::modified(const Integrator& integrator)
ao_samples == integrator.ao_samples &&
mesh_light_samples == integrator.mesh_light_samples &&
subsurface_samples == integrator.subsurface_samples &&
- motion_blur == integrator.motion_blur);
+ motion_blur == integrator.motion_blur &&
+ sampling_pattern == integrator.sampling_pattern);
}
void Integrator::tag_update(Scene *scene)